The name of the current C ++ function as a string

Is there a way to get the current function name in C ++? I want to track the order of some features. Is there something like __FILE__ or __LINE__ ?

Thanks!

+7
c ++ gcc
source share
2 answers

Using

 __FUNCTION__ //or __PRETTY_FUNCTION__ 
+11
source share

Or, if you want to be compatible with the C ++ 0x speed (sic) standard, use __func__ if your compiler supports it (GCC), which will be portable.

+10
source share

All Articles