Current versions of NSAssert() use pre-sourcing variable macros, i.e. __VA_ARGS__ . Since variable macros are a function of C99, I believe that older versions of the SDK do not allow variable arguments in NSAssert() , hence the need for NSAssert1() , NSAssert2() , etc.
If you try to compile
NSAssert(0, @"%@%@", @"foo", @"bar");
using -std=c89 or -ansi (ISO C90, an older version of C that does not support variable macros), you get a compiler error:
error: too many arguments provided to function-like macro invocation NSAssert(0, @"%@%@", @"foo", @"bar");
For this code to compile with -std=c89 or -ansi you need to use NSAssert2() :
NSAssert2(0, @"%@%@", @"foo", @"bar");
user557219
source share