Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

G++ __FUNCTION__ on method's with class name?

Is there a compile-time constant like __FUNCTION__ or __func__ that includes for class methods also the class name?

For example for a method named foo in class Bar it should not expand to foo but to Bar::foo.

like image 280
JonDoes Avatar asked Oct 20 '25 08:10

JonDoes


1 Answers

Yes, with GCC or Clang you can use the non-standard extension __PRETTY_FUNCTION__ which gives the full signature e.g. void Bar::foo(int)

See http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html

like image 65
Jonathan Wakely Avatar answered Oct 22 '25 03:10

Jonathan Wakely



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!