What predefined macro can be used to detect debug build with clang?

前端 未结 4 1063
梦毁少年i
梦毁少年i 2021-02-20 03:20

MSVC defines _DEBUG in debug mode, gcc defines NDEBUG in release mode. What macro can I use in clang to detect whether the code is being compiled for r

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-20 03:51

    There is no such thing as a debug mode in a command line compiler. That is a IDE thing: it just sets up some options to be sent to the compiler.

    If you use clang from the command line, you can use whatever you want. The same is true for gcc, so if with gcc you use NDEBUG you can use just the same.

提交回复
热议问题