Hi and happy new year,
I'm having a doubt about a simple thing : i know that macros are evaluated at compile time, but does their position have an importance? Let me explain.
if i have for example
1 2 3 4 5 6 7 8
#define SOMEMACRO//line that can be present or not depending on my code generator
doStuff();
if(condition()){
#ifdef SOMEMACRO
doSpecificStuff();
#undef SOMEMACRO
#endif
}
Will SOMEMACRO be undefined even if condition() is false? Sorry for the stupid question :P
All preprocessor commands (anything that starts with a #) ignore all scope and language rules (one of the many reasons you generally want to avoid them when possible).
They're sort of like a separate language that is run through and compiled before the actual C++ code is even started to be compiled.