D still has macros ..

Hasan Aljudy hasan.aljudy at gmail.com
Thu Apr 20 17:16:28 PDT 2006


Isn't __FILE__ really just a macro? it's processed before tokenizing! 
according to the specc, if the lexer sees __FILE__ or __LINE__ or such, 
it should convert it to an appropriate string/number/whatever before 
tokenizing it. Hence, it's a macro.

This implies that __FILE__ and such cannot be used in mixins or 
templates to mimic things like the following C macro:

#define log(s) logprintf(__FILE__ ": " __FUNCTION__ ": %s", s)

Shouldn't these things become templates (or something like that) so that 
we can use them like the above C macro, but with D templates?



More information about the Digitalmars-d mailing list