Entry tags:
Stupid GCC
$ cat t.c #include <stdio.h> int main(void) { return printf(""); } $ gcc -Wall -c t.c t.c: In function ‘main’: t.c:2: warning: zero-length printf format string $ gcc -Wall -Wno-format-zero-length -c t.c $ gcc --version gcc (Debian 4.3.2-1.1) 4.3.2 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Can anyone offer a plausible reason why:
- -Wformat-zero-length is on by default (i.e. implied by -Wformat and thus by -Wall)?
- Why it exists at all?
FTAOD, empty format strings are perfectly legitimate (and the GCC Manual knows this).
no subject
no subject
__attribute__((printf))
feature.