4 ms·
`NSArray` is not `nil` terminated; the argument lists to some of its variadic initializers are, but the array itself simply does not contain `nil`. The literal
by b3morales 4y ago
`NSArray` is not `nil` terminated; the argument lists to some of its variadic initializers are, but the array itself simply does not contain `nil`.
The literal syntax `@[ ... ]` gets transformed into an initializer call, which throws an exception if it is passed a `nil` value. And I can't remember, but I would expect the compiler to at least warn, if not error, if you put a literal `nil` in there.
- arcticbull 4y agoThey're just referring to -[NSArray arrayWithObjects:...] which takes a va_list. Same with -[NSDictionary dictionaryWithObjectsAndKeys:...] These both long predate the array and dictionary literal syntax.