macro to print local information (about function name etc)

J

Johannes Zellner

Hello,

Is it possible to have a preprocessor macro, which prints information
like the function name of the current context like

void SomeClass:some_member()
{
NIFTY_MACRO();
...

should print the class name SomeClass and the method name some_member.
 
V

Victor Bazarov

Johannes said:
Is it possible to have a preprocessor macro, which prints information
like the function name of the current context like

void SomeClass:some_member()
{
NIFTY_MACRO();
...

should print the class name SomeClass and the method name some_member.

Some compilers have preprocessor macros like PRETTY_FUNCTION or some
such. Standard C++ has no means to do what you ask.

V
 
B

BobR

Victor Bazarov wrote in message ...
Some compilers have preprocessor macros like PRETTY_FUNCTION or some
such. Standard C++ has no means to do what you ask.

V
--

GNU GCC/MinGW:
__FUNCTION__
__PRETTY_FUNCTION__

and more, like (standardized by ANSI C):
__LINE__
__FILE__
__TIME__
__DATE__
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top