What is the difference between -DNDEBUG and -DNS_BLOCK_ASSERTIONS flags
Asked Answered
A

1

5

I've tried FauxPas source code analyzer and it showed me that I am missing -DNDEBUG flag, with next description:

This argument disables the C standard library assertion macro (as defined in assert.h).

Though, when I check my build settings I found very similar by description flag -DNS_BLOCK_ASSERTIONS=1.

So I wonder now. Do I really need the flag that FauxPas suggests or I am fine with the one I have?

Agile answered 13/11, 2015 at 11:18 Comment(0)
I
11

NDEBUG disables assert(), which is part of the C standard library. NS_BLOCK_ASSERTIONS disables NSAssert() which is part of Foundation. You generally will require both if you have both kinds of assertions in your code.

Infrequency answered 13/11, 2015 at 14:17 Comment(4)
You wrote NDEBUG, but I asked about DNDEBUG is it the same?Agile
The first -D is for "define". -DNDEBUG means "define NDEBUG"Infrequency
so how does "define" affects the DNDEBUG? its like saying define disable assert() ?Shebashebang
@Shebashebang Correct. It creates a pre-processor macro NDEBUG with the value of 1.Infrequency

© 2022 - 2024 — McMap. All rights reserved.