Edward Diener wrote:
Well, #pragmas that the compiler doesn't understand are supposed to be ignored. However, using a header for it is also a good option. You can even use a macro to introduce the header if you like:
#include CREATE_PRAGMA()
Will the above really work ? I was always pretty sure that #includes have to be processed before macros are expanded and not after.
Yes. Actually, it works on all compilers too. The file-iteration mechanism, among other things, of the pp-lib uses this behavior all the time. More specifically though, both the Python library and the MPL both use file-iteration extensively. Technically speaking, the #line, #include, #if, and #elif directives must be macro-expanded. For #error and #pragma directives, the behavior is unspecified, but the C99 standard explicitly says that #pragma's of the form: #pragma STDC xyz ...are _not_ macro expanded, even if other #pragma's are. All other directives make no sense to macro-expand. (#define, #undef, #else, #endif) Regards, Paul Mensonides