__FUNC__ in D

argl me at somewhere.com
Wed Aug 15 10:19:08 PDT 2007


That would be wonderful! 
I am getting the following errors though.
Where do I find GetLastFnDef() ?

dmd -Jpath -run ./test.d
test.d(80): Error: undefined identifier GetLastFnDef
test.d(80): Error: need -Jpath switch to import text file test.d
test.d(80): Error: function expected before (), not GetLastFnDef of type int
test.d(80): Error: cannot implicitly convert expression (GetLastFnDef("",80L)) of type int to char[]


BCS Wrote:

> Reply to Jarrett,
> 
> > "argl" <cavenhaus at gmail.com> wrote in message
> > news:f9qrup$nqe$1 at digitalmars.com...
> > 
> >> Hi, I know this has come aup a few times in the past, but I have not
> >> come across a clear answer.
> >> 
> >> Is it possible in any way to get the name of the current function for
> >> logging purposes? Something to get the functionality of __FUNC__ in
> >> C?
> >> 
> > No.
> > 
> 
> CTFE anyone?
> 
> char[] GetLastFnDef(char[] file, int line);
> 
> use like this:
> 
> const char[] fn = GetLastFnDef(import(__FILE__), __LINE__);
> 
> 



More information about the Digitalmars-d-learn mailing list