How to get the function name while in a function for debug strings?

前端 未结 5 1475
故里飘歌
故里飘歌 2021-02-01 20:35

I want to output the function name each time it is called, I can easily copy and paste the function name, however I wondered if there was a shortcut that would do the job for me

5条回答
  •  抹茶落季
    2021-02-01 20:56

    __func__ is c99 ( which does in turn mean it might not work with visual studio - but hey it's standard :o) )

    __FUNCTION__ works pretty much everywhere

    __PRETTY_FUNCTION__ is gnu specific and returns the full qualified name with (namespaces?), classname, returntype, functionname, parameterslist

提交回复
热议问题