[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Pimpl copying
From:       Peter Kümmel <syntheticpp () gmx ! net>
Date:       2006-07-15 7:26:52
Message-ID: 44B898BC.1050109 () gmx ! net
[Download RAW message or body]

Michel Hermier wrote:
>> --- kdemacros.h.cmake   (revision 562532)
>> +++ kdemacros.h.cmake   (working copy)
>> @@ -413,8 +413,8 @@
>>
>>  #define KDE_PIMPL_BASE_MACRO(COPY_ACCESS,X) \
>>  COPY_ACCESS: \
>> -    X(const X##&); \
>> -    X##& operator=(const X##&); \
>> +    X(const X &); \
>> +    X & operator=(const X &); \
>>  private: \
>>      class X##Private; \
>>      X##Private * const d;
>>
>> Is this a gcc bug or is X##& an invalid preprocessor command?
>>
> 
> For me X##& is an invalid preprocessor command. The aim off the ##
> preprocessor directive is to build a new name from a template
> argument. But & was never legal as a part of a variable name. So the
> preprocessor say that the result "Foo&" don't qualify a valid variable
> name (token).

Yes, this sounds reasonable. For the  COPY_ACCESS argument I also don't
use ## to add a : to the end.

> "X &" works but I think "X&", as this, should also works since the
> preprocessor should see it as 2 tokens.

## was superfluous, and for a strict compiler it is an error.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic