Change in preprocessor behavior

Neil Booth neil@daikokuya.co.uk
Mon Dec 30 20:54:00 GMT 2002


Stephen Lindholm wrote:-

> thrush:~% cpp test2
> # 1 "test2"
> 
>       
> struct command commands[] =
> {
>   { #quit, quit ## _command },
>   { #help, help ## _command },
> };

Contrary to your claim, I suspect you're using cpp -traditional, no?

Traditional preprocessors did not support # and ##, and 3.1 is more
"correct" in this respect.  FWIW 3.3 has another new implementation of
traditional preprocessing which is the most faithful of GCC's
implementations to true traditional preprocessing.

Neil.



More information about the Gcc mailing list