__FILE__ and __LINE__ 'forwarding'

Lionello Lunesu lio at lunesu.remove.com
Fri Sep 22 05:07:17 PDT 2006


#void test(int i=__LINE__) { printf("%i",i);}
#void main() {
#  test(); // prints 1
#}

It would be really handy if the __LINE__ default parameter value would 
be evaluated at the line containing the call. This way we can mimic 
those C logging macros.

Is there currently any way to do this without writing __LINE__, __FUNC__ 
on every call?

L.



More information about the Digitalmars-d-learn mailing list