How can we know the caller function's name?

后端 未结 10 1604
北海茫月
北海茫月 2020-12-02 10:26

In the C language, __FUNCTION__ can be used to get the current function\'s name. But if I define a function named a() and it is called

10条回答
  •  执笔经年
    2020-12-02 11:17

    If you are using Linux system, you can use the backtrace() function.

    See the man page for more details and a code example.

提交回复
热议问题