In C++, is there a way to get the function signature/name from it’s pointer like this?
void test(float data) {}
cout << typeid(&test).name();
I want to use this data for logging.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you just want to log the current function name, most of the compilers have
__FUNCTION__macro, which will give you the current function name at compile time.You may also look for stack walking techniques (here is an example for Windows), which can provide you more information about the current call stack and function names at runtime.