R
Ron
Please, consider the following code:
const int a = 1;
#if a == 1
#define VAR 200
#else
#define VAR 100
#endif
int main() {
cout << VAR << endl;
return 0;
}
Under some compiler it prints 200. So a preprocessing directive can check
constant values. Is it a standard C++ feature?
But how can be possible? Syntax analysis, following the standard, is done
after all preprocessing directive are executed, so how can an #if
be aware about a "const int" construct?
Regards.
const int a = 1;
#if a == 1
#define VAR 200
#else
#define VAR 100
#endif
int main() {
cout << VAR << endl;
return 0;
}
Under some compiler it prints 200. So a preprocessing directive can check
constant values. Is it a standard C++ feature?
But how can be possible? Syntax analysis, following the standard, is done
after all preprocessing directive are executed, so how can an #if
be aware about a "const int" construct?
Regards.