|
|
|
|
|
by Stenzel
3329 days ago
|
|
I am missing the motivation to purge the preprocessor - only reason he gives is the paradigm that the preprocessor is considered bad practice. I fail to see why.
The preprocessor is a useful tool that can save you time and make code more readable and portable. Conditions at compile time guarantee that the compiler is not subjected to a specific portion of code, and it offers the only way to define a constant value without having an implicit type for that.
Considering the use of C/C++ outside pure computer programming, like embedded systems or digital signal processing, where portability, code size and target specific substitutions or optimisations matter, there is simply no reason and no way to get rid of the preprocessor without breaking things.
Sure you can use it in obscure and wrong ways, but it is not the job of the language to act as a nanny and prevent you from doing evil by restricting access to dangerous toys. |
|
> like embedded systems or digital signal processing, where portability, code size and target specific substitutions or optimisations matter, there is simply no reason and no way to get rid of the preprocessor without breaking things.
It certainly is, I know embedded projects where they use template meta programming to get an even more advanced code generator.