I searched around a little bit for information on this but didn't find anything satisfactory. Is there some special behavior to the function call
sprintf(someString, "");
that explains why this is warning (on gcc with -Wall)? I only managed to find that the C standard allows zero-length format strings.
I tried the following example
#include <stdio.h>
int main()
{
char str[2] = {'a', 'a'};
sprintf(str, "");
printf("\'%c\'\'%c\'\n", str[0], str[1]);
return 0;
}
which prints out
'''a'
which is exactly what I expected to see. So, why the warning?