bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with pasting two tokens together in gcc 3.4


From: Nix
Subject: Re: problem with pasting two tokens together in gcc 3.4
Date: Wed, 18 May 2005 16:05:39 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Corporate Culture, linux)

On 18 May 2005, Deepak Soi moaned:
> Hi, Yes, you are right problem we are facing is with pasting two
> tokens together,

You shouldn't use ## to paste two tokens together if there result would
be parsed as two tokens (as is the case below). Its purpose is to paste
two tokens together to yield *one* token. That is,

#define IdentifierComposition (x, y) x##y
IdentifierComposition(Some,Function)

would yield the *single token* `SomeFunction'.

>                  but what I am unable to understand is why its
> compiling properly with older gcc versions. Is there any change in
> gcc3.4 handling of macros.

The preprocessor was rewritten completely before GCC 3.0, and has got
progressively stricter (i.e. more standards-compliant) since then.
I believe even GCC-3.0 complained about this (erroneous) construct,
but I'm not certain.

>  find.cxx:723:1: pasting "DbNet" and "*" does not give a valid preprocessing 
> token.
>   find.cxx:723:1: pasting "Net" and "*" does not give a valid
> preprocessing token.
>   find.cxx:723:1: pasting "FindFromDbNet" and "(" does not give a
> valid preprocessing token.

You shouldn't be using ## in any of those cases. Exactly how your macros
should be restructured depends on what the macros are doing, but probably
you can replace a##b with a simple `a b'.

-- 
`End users are just test loads for verifying that the system works, kind of
 like resistors in an electrical circuit.' - Kaz Kylheku in c.o.l.d.s




reply via email to

[Prev in Thread] Current Thread [Next in Thread]