I’m not experienced in C, so I’m not comfortable with this statement in this C / objective-C project.
#define CBLog(...) NSLog(@"%s [%ld]: %@", basename(__FILE__), __LINE__, [NSString stringWithFormat:__VA_ARGS__])
Questions:
-
the 3 dots (…) are used to indicate CBLog() is a method with parameters ? What do they mean ?
-
%ld stands for line format ? what’s the d in %ld for ?
-
FILE , LINE and VA_ARGS are default replacement tokens for the C debugger ?
thanks
The
...means the macro accepts any number of arguments.%ldis a string formatter meaning ‘long decimal’, where decimal really means integer.__FILE__expands to the current file name__LINE__expands to the current line number__VA_ARGS__expands to the arguments passed to the macro.The debugger has nothing to do with it. All of this is the preprocessor, except
%ldwhich is string formatting.