System programming in D (Was: The God Language)

Timon Gehr timon.gehr at gmx.ch
Fri Dec 30 20:34:32 PST 2011


On 12/31/2011 05:19 AM, Walter Bright wrote:
> On 12/30/2011 8:02 PM, Timon Gehr wrote:
>> On 12/31/2011 04:50 AM, Walter Bright wrote:
>>> Because inevitably someone will write:
>>>
>>> #define FOO a + FOO
>>>
>>> and expect it to work (the correct expansion would be "a + FOO", not a
>>> stack overflow). The C preprocessor works this way, as do makefile
>>> macros, as Ddoc does.
>>
>> Makes sense, but why is it an issue if expansion is explicit?
>>
>> enum FOO = q{a + FOO};
>>
>> mixin(FOO);
>
> Because the expanded text is then rescanned for further macro replacement.
>

Yes, but in q{a + FOO} there is none.


More information about the Digitalmars-d mailing list