Annoying pre-processor fluke.

Alexandre Oliva oliva@dcc.unicamp.br
Mon Oct 5 03:23:00 GMT 1998


Benjamin Scherrey <scherrey@switchco.com> writes:

>     I'm running egcs1.1 on HPUx and my debug preprocessor code that I've
> run on other compilers (can't guarantee it was egcs though) is suddenly
> breaking my build

>     #define PDBUG /##/ Junk

> PDBUG << "This is a debug message." << endl;

This is not Standard C++.  According to the Standard,
comment-stripping must take place before macro expansion.  In this
particular case, you can define:

      #define PDBUG 0 || cerr

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc mailing list