Question

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!

Was it helpful?

Solution

Use

__FUNCTION__
//or
__PRETTY_FUNCTION__

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top