www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - anyone knows how to print __FUNCTION__ in D? and __LINE__

reply davidl <davidl 126.com> writes:
in c we can print __FUNCTION__ __LINE__ to indicate where we are. in D how  
to do, couldn't find.....
-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/
Aug 14 2006
next sibling parent reply Oskar Linde <oskar.lindeREM OVEgmail.com> writes:
davidl wrote:
 
 in c we can print __FUNCTION__ __LINE__ to indicate where we are. in D 
 how to do, couldn't find.....
 --使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/

__LINE__ works in D too. I'm not sure if __FUNCTION__ has much use in D, as D lacks macros that could make use of it. (Evaluate it at the place of macro expansion). /Oskar
Aug 14 2006
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Oskar Linde" <oskar.lindeREM OVEgmail.com> wrote in message 
news:ebpvni$2l64$1 digitaldaemon.com...

 __LINE__ works in D too. I'm not sure if __FUNCTION__ has much use in D, 
 as D lacks macros that could make use of it. (Evaluate it at the place of 
 macro expansion).

In addition, you can find the list of all supported special tokens at http://www.digitalmars.com/d/lex.html#specialtokens.
Aug 14 2006
prev sibling parent BCS <BCS pathlink.com> writes:
davidl wrote:
 
 in c we can print __FUNCTION__ __LINE__ to indicate where we are. in D 
 how  to do, couldn't find.....

__FILE__":"~itoa!(__LINE__) writef(...) // at run time pragma(msg, ...)// at compile time Not quite as useful but close. BTW it requiters the itoa template that can be found about half way down this page: http://www.digitalmars.com/d/templates-revisited.html
Aug 14 2006