2010-05-02 6 views

Antwort

7

NSCAssert() (und auch NSCAssert1(), ... bis zu NSCAssert5())

4
void assert(int expression); 

If expression evaluates to 0 (false), then the expression, source code filename, 
and line number are sent to the standard error, and then calls the abort 
function. 

If the identifier NDEBUG ("no debug") is defined with #define NDEBUG then the 
macro assert does nothing. 

Beispiel:

assert(x != 0); 

Anmerkung: Fügen Sie assert.h

+0

Beachten Sie auch http://vgable.com/blog/2008/12/04/nsassert-consided-harmful für 'assert (x! = 0 &&" Was zum Teufel? ")' ... coole Sachen . –

Verwandte Themen