function name macro

Ramadass, Ramanathan Ramanathan.Ramadass@spirentcom.com
Tue Dec 2 20:21:00 GMT 2003


Yep. Do "info gcc" on your system and go to the "Function Names" node. Here is the relevant text;

 GCC predefines two magic identifiers to hold the name of the current
function.  The identifier `__FUNCTION__' holds the name of the function
as it appears in the source.  The identifier `__PRETTY_FUNCTION__'
holds the name of the function pretty printed in a language specific
fashion.

Thanks
Ram

-----Original Message-----
From: vu pham [mailto:vu@sivell.com]
Sent: Tuesday, December 02, 2003 12:20 PM
To: gcc-help@gcc.gnu.org
Subject: function name macro


Hi all,

Is there any macro that produces the function name of the function that 
uses this macro ?

For example :

int foo( int a )
{
	printf( __FUNCTION_NAME__ " a = %d", a );
	. . .
}

Thanks,

Vu



More information about the Gcc-help mailing list