On Sun, Oct 07, 2007 at 11:45:51PM +0200, J. Mayer wrote: > I also took a look in C 99 specification and I saw no restriction on > writing: > do_this(a, > #ifdef _this_is_defined > b, > #else > c, > #endif > d); > when do_this() is defined as a macro. > > May I suggest you to use a C99 compliant compiler ? > I don't feel like making my code less readable just because some use > buggy compilers. (but if someone tells me what in the ISO C > specification, that I would have missed, explicitelly forbids this).
I'm pretty sure that it was either forbidden or unspecified, at least in C89. I didn't check C99. http://gcc.gnu.org/ml/gcc/1999-07n/msg00243.html > ISO says in 6.8.3 (Macro replacement): "If there are sequences of > preprocessing tokens within the list of arguments that would otherwise > act as preprocessing directives, the behavior is undefined." GCC did not support it until here: http://gcc.gnu.org/ml/gcc-patches/2002-02/msg01874.html -- Daniel Jacobowitz CodeSourcery