Reputation: 2189
I have seen someone declaring a method in Objective C like this:
- (FMResultSet *)executeQueryWithFormat:(NSString*)format, ...;
Can anyone tell me what does the dotted notation at the end of the method declaration represent here?
Upvotes: 0
Views: 85
Reputation: 59617
The ...
represents a variable-length argument list, analogous to a variadic function in standard C. It indicates that the message can accept a variable number of arguments.
Within the message implementation variadic arguments are handled just the same way as in a standard C function, except in Objective-C the argument list is typically nil
terminated. The same header file stdarg.h
is used, and the same va_list
type and associated macros for manipulating the list.
See this OS X Developer document for an example; and some standard C examples here.
Upvotes: 3