3 ms·
#define is a problem in general because the compiler doesn't understand as well what is happening because the substitutions take place outside of the language's
by zaphoyd 13y ago
#define is a problem in general because the compiler doesn't understand as well what is happening because the substitutions take place outside of the language's type system. Extensive preprocessor use makes writing analysis tools, refactoring IDEs, and sane compiler errors much more complicated. Const in C doesn't behave similarly to #define so it isn't really a substitute.
Note: in C++, global/static const values do behave as compile time constant expressions and are an excellent tool for this purpose.