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

前端 未结 4 1085
梦毁少年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:46

    Compilers don't define those macros. Your IDE/Makefile/ does. This doesn't depend on the compiler, but on the environment/build helper program you use.

    The convention is to define the DEBUG macro in debug mode and the NDEBUG macro in release mode.

提交回复
热议问题