Newline inside macro expansion

Zack Weinberg zack@codesourcery.com
Sun Dec 14 18:50:00 GMT 2003


"Bansidhar Arvind Deshpande  - CTD, Chennai." <bansidhara@ctd.hcltech.com> writes:

> Hi all,
>
> This may be simple C preprocessor question. 
>
> I want to write a macro which should have '\n' in its expansion.

Sorry, this is impossible.  However, in the example you give

> if(a == param1) 
> b = param2;

the C compiler does not care if it appears entirely on one line:

  if (a == param1) b = param2;

so you can just define the macro in the obvious fashion.  If this is
some language other than C, where newlines are significant, you should
use a different preprocessor.  M4 for instance.

zw



More information about the Gcc mailing list