1// we'll use __builtin_FUNCTION() to get the name of caller function
2
3#include <iostream>
4
5const char* return_caller(const char* caller = __builtin_FUNCTION()){
6 return caller;
7}
8
9void test(){
10 printf("%s\n",return_caller());
11}
12
13int main(){
14 test();
15 printf("%s\n",return_caller());
16}
17
18// you can run it in: http://cpp.sh/7beb