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?
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?
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 filestdarg.h
is used, and the sameva_list
type and associated macros for manipulating the list.See this OS X Developer document for an example; and some standard C examples here.