Visual C++ equivalent of __FILE__ , __LINE__ and __PRETTY_FUNCTION__

后端 未结 8 2229
后悔当初
后悔当初 2020-12-14 08:50

GCC compiler gives me the following macros:

  • __FILE__ so that I can print out the file name + directory.
  • __LINE__ so that I c
相关标签:
8条回答
  • 2020-12-14 09:35

    __FILE__ and __LINE__ are standard since C89. __PRETTY_FUNCTION__ is a GCCism. __func__ is a C99ism which (unlike GCCisms) may well be available in Visual C++; it is not precisely the same as __PRETTY_FUNCTION__ but it may be close enough for your purposes.

    0 讨论(0)
  • 2020-12-14 09:41

    Yes Visual C++ has them or an equivalent. See the responses here:

    What's the difference between __PRETTY_FUNCTION__, __FUNCTION__, __func__? function-func/4384860#4384860

    Also note that despite the upper case used, they aren't macros. They're variables.

    0 讨论(0)
提交回复
热议问题