Annoying pre-processor fluke.

Alexandre Oliva oliva@dcc.unicamp.br
Tue Oct 6 16:19:00 GMT 1998


I wrote:

>> >       #define PDBUG 0 || cerr
>> 
>> I obviously meant:    true || cerr
>> or:    false && cerr

Tim Hollebeek <tim@wagner.Princeton.EDU> writes:

> Or, of course, the non-preprocessor hack way (the only drawback here is
> you need -O to get rid of the empty calls):

I'd write:

class ignore {
  template <class T> ignore& operator<<(T) { return *this; }
};

However, this will still evaluate the operands of operator<<, which is
not usually what you want.

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




More information about the Gcc mailing list