Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the NS_BLOCK_ASSERTIONS disable both NSAssert and assert() calls?

Does the NS_BLOCK_ASSERTIONS switch off just the NSAssert calls or also the assert() calls. My app crashes in the Release mode on the line with assert(...) statement.

The documentation says only about NSAssert and does not tell if assert() calls are being disabled.

There are a couple questions related to mine that are not answering it. I'm linking them here:

NS_BLOCK_ASSERTIONS in Objective-C
NSAssert vs. assert: Which do you use, and when?
How to know if NSAssert is disabled in release builds?

like image 524
Rafa de King Avatar asked Aug 20 '13 16:08

Rafa de King


1 Answers

No, assert() is controlled with the NDEBUG symbol:

#ifdef NDEBUG
#define assert(e)   ((void)0)
#else
...

(see /usr/include/assert.h if you have the Xcode Command Line Tools installed, or elsewhere in the Xcode.app bundle, if not).

like image 51
trojanfoe Avatar answered Dec 18 '22 17:12

trojanfoe