2010-05-02 36 views

Trả lời

7

NSCAssert() (và cũng NSCAssert1() ... lên đến 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. 

Ví dụ:

assert(x != 0); 

lưu ý: Bao gồm assert.h

+0

Cũng lưu ý http://vgable.com/blog/2008/12/04/nsassert-considered-harmful cho 'assert (x! = 0 &&" what the hey? ")' ... cool stuff . –

Các vấn đề liên quan