Feature: __FUNCTION__ to give name of parent function.

Jonathan M Davis jmdavisProg at gmx.com
Tue Dec 21 11:40:41 PST 2010


On Tuesday, December 21, 2010 08:20:06 Iain Buclaw wrote:
> This was a question asked in IRC, someone wanting a way to have the parent
> function name outputted for logging purposes. Just like there is __LINE__
> and __FILE__ for access to the line number and filename, would be handy
> (and trivial to implement) if there was a __FUNCTION__ variable also for
> outputting the bare name of the function. Optionally could also add a
> __PRETTY_FUNCTION__ too for outputting the type signature of the function.
> 
> ie:
> writeln(__FUNCTION__); // foo
> writeln(__PRETTY_FUNCTION__); // int foo(string)
> 
> Regards

__FUNCTION__ exists in C++. I added a feature request for it a couple of months 
ago: http://d.puremagic.com/issues/show_bug.cgi?id=5140


More information about the Digitalmars-d mailing list