odd use of preprocessor

Ellery Newcomer ellery-newcomer at utulsa.edu
Sun Nov 6 12:36:47 PST 2011


On 11/06/2011 01:50 PM, Alex Rønne Petersen wrote:
> On 06-11-2011 20:43, Ellery Newcomer wrote:
>> poking about in elfutils headers, I've come across the following idiom
>> several times
>>
>> /* Error values.  */
>> enum
>>    {
>>      DW_TAG_invalid = 0
>> #define DW_TAG_invalid  DW_TAG_invalid
>>    };
>>
>>
>> anyone know if anything strange is going on here that would prevent
>> trivial conversion to d?
> 
> The only thing I can think of is fully-qualified enums. The #define
> ensures that you _don't_ have to fully qualify DW_TAG_invalid. But why
> they would do this (considering C doesn't have this enum feature), I
> don't know.
> 
> - Alex

nor c++, right?


More information about the Digitalmars-d-learn mailing list