tags:

views:

150

answers:

2

Hello,

Is there any way to get current function name in C++? I want to track some functions calls order. Is there something like __FILE__ or __LINE__?

Thank you!

+7  A: 

Use

__FUNCTION__
//or
__PRETTY_FUNCTION__
Vladimir
Thanks, it works:) It's very useful for render functions that you can't debug nice with breakpoints
Felics
+6  A: 

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

anon
Or, it you want to be compatible with the _current_ standard: `#ifdef MYFN`, `#undef MYFN`, `#endif`, `#define MYFN nameofmyfunction` before every function you write :-)
paxdiablo