12

I am trying to understand D_GLIBCXX_DEBUG and DNDEBUG flags.

But I can't find information about them.

Can anyone explain what they do? and where can I read more about them?

Pratik Deoghare
  • 35,497
  • 30
  • 100
  • 146

1 Answers1

9

Both use -D which defines the macro given after the D.

When NDEBUG is defined, assert does not check its argument.

When _GLIBCXX_DEBUG is defined, it activates debug mode in libstdc++ (causing libstdc++ to perform checks on various operations).

Community
  • 1
  • 1
Mankarse
  • 39,818
  • 11
  • 97
  • 141
  • So you write `-DNDEBUG` and `-D_GLIBCXX_DEBUG` when conjuring compiler via command line, right? – shuhalo Jan 07 '18 at 18:24
  • @shuhalo: Yes, if you want the `NDEBUG` and `_GLIBCXX_DEBUG` macros to be defined during compilation. – Mankarse Jan 07 '18 at 22:40