[haiku-development] Re: GCC 2.95 and certain #define macros

  • From: "François Revol" <revol@xxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 21 Aug 2007 15:27:20 +0200 CEST

> > The errors are all in the preprocessor, it never passes it off to
> > the
> > compiler.
>
> According to the ISO C++ standard (my copy is: ISO/IEC 14882, Second
> edition, 2003-10-15) about conditional inclusion (i.e. #if
> directives):
>
> "Prior to evaluation, macro invocations in the list of preprocessing
> tokens
> that will become the controlling constant expression are replaced
> (except
> for those macro names modified by the *defined* unary operator), just
> as in
> normal text. If the token *defined* is generated as a result of this
> replacement process ... the behavior is undefined."
>
> So, unless the standard changed in that respect since October 2003,
> the
> code you stumbled upon uses preprocessor behavior undefined by the
> standard
> and implemented differently by gcc 4 and 2.95.3.
>


You might want to search for posts from people trying to port to other
compilers (icc, ...) as they likely have the same problem.
In any case since it's not part of the standard it can be considered as
a bug, so you are free to send them a patch that fixes it :)


François.

Other related posts: