System programming in D (Was: The God Language)

Walter Bright newshound2 at digitalmars.com
Fri Dec 30 22:50:29 PST 2011


On 12/30/2011 10:50 PM, Walter Bright wrote:
> On 12/30/2011 8:34 PM, Timon Gehr wrote:
>> 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.
>
> #define FOO a+Foo
> FOO;
>
> What is the text after macro expansion?

Blast, I meant

#define FOO a+FOO
FOO;


More information about the Digitalmars-d mailing list