I want to know how to find out if the __PRETTY_FUNCTION__ preprocessor macro __PRETTY_FUNCTION__ be used with this compiler (since it must be non-standard). How to check this in the header file? I want to do something like:
#ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __func__ #endif
But I assume that the preprocessor defines an in-place macro for each function, so I wonder if it makes sense for __PRETTY_FUNCTION__ (unlike __FILE__ or __LINE__ ) outside the function. Is this true or can I just use the code above? If not, how can I check it?
EDIT: I tried. __PRETTY_FUNCTION__ undefined outside the function (I did not check inside the class). So there must be another way.
EDIT2: Actually a simple hack would have to do this :):
void Dummy() { #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __func__ #endif }
Another method is to check the compiler as suggested by others.
source share