How to get a function name (string) @ compile time

Daniel Ribeiro Maciel daniel.maciel at gmail.com
Sun Nov 2 14:59:56 PST 2008


How do we get a function name (string) @ compile time?

I need to do stuff like (in C)

#include <stdio.h>

#define HELLO( func ) \
  printf( "calling " #func "\n" ); \
  func();

void foo()
{
	printf( "@foo" );
}

int main()
{
	HELLO( foo );
	printf( "\n" );
}

The output is:
calling foo
@foo

Thanks in advance,
Daniel



More information about the Digitalmars-d-learn mailing list