Function Names as Strings

Don nospam at nospam.com.au
Fri Oct 17 01:57:23 PDT 2008


ore-sama wrote:
> Is there something similar in D?
> http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Function-Names.html#Function-Names

No. Unless you count declaring a local variable and using my NameOf module.

module SomeModule;
import meta.NameOf;

void foo(int z, double q) {
   int dummy;
   const char [] funcname = prettyNameOf!(dummy);
   static assert(funcname == "void SomeModule.foo(int, double)");
}


More information about the Digitalmars-d-learn mailing list