Dear there, is there a way to print the function's name inside itself? I know the trick to print a variable name in macro using #:
#define P(x) cout << #x << ": " << x << endl;
I am wondering whether there is a similar way to do it for functions.
Printable View
Dear there, is there a way to print the function's name inside itself? I know the trick to print a variable name in macro using #:
#define P(x) cout << #x << ": " << x << endl;
I am wondering whether there is a similar way to do it for functions.
GCC has the __FUNCTION__ and __PRETTY_FUNCTION__ macros. Other compilers probably have same or similar macros.