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

  • From: "Ryan Leavengood" <leavengood@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 18 Aug 2007 21:17:59 -0400

On 8/18/07, François Revol <revol@xxxxxxx> wrote:
>
> The ## is supposed to be able to concat 2 strings to form an
> identifier.

Indeed.

> It should work in 2.95 as well.
> But this construct looks like it tries to create preprocessor stuff
> from a define, while the preprocessor only has a single pass, I wonder
> how it can even work with gcc4.

I'm not exactly sure, but it does indeed work with GCC 4, and also
with whatever compilers are used on Mac OS X and Windows. So I don't
think it is an invalid construct. My understanding was that the
preprocessor will continue to process the input until all macros have
been expanded. So the single pass thing isn't quite true.

> Of course it preprocesses this into
> (defined( WFT_...
>
> and passes this to the compiler which doesn't know what defined is
> about.

The errors are all in the preprocessor, it never passes it off to the compiler.

Ryan

Other related posts: