I see this line in C:
#define log(format, args...) snprintf(buffer + strlen(buffer), 1023 - strlen(buffer), format, ##args);
What does the double pound / hash mean before the last param in snprintf()
?
I see this line in C:
#define log(format, args...) snprintf(buffer + strlen(buffer), 1023 - strlen(buffer), format, ##args);
What does the double pound / hash mean before the last param in snprintf()
?
In standard C, the "##
" is for concatenating tokens together within a macro. Here, this macro is not in standard C, but in "Gnu C", the dialect implemented by GCC. The "##
" is used to remove the comma if the extra arguments (in args
) turn out to be empty. See the GCC manual.