From: Martin Stromberg Message-Id: <200205271315.PAA09349@lws256.lu.erisoft.se> Subject: Useless warning from gcc 3.1 To: gcc-bugs AT gcc DOT gnu DOT org Date: Mon, 27 May 2002 15:15:17 +0200 (MET DST) Cc: djgpp-workers AT delorie DOT com (DJGPP-WORKERS) X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Consider this program (h.c): #include int main(void) { char s[10]; printf(""); sprintf(s, ""); return 0; } Platform is DJGPP and gcc --version says: gcc.exe (GCC) 3.1 Copyright (C) 2002 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. gcc -Wall h.c -O2 says: h.c: In function `main': h.c:7: warning: zero-length format string h.c:8: warning: zero-length format string Why is a "" format string worthy of a warning? There are perfectly legitimate uses for emtpy format strings, e. g. automatically generated ones. Can anyone give me a valid good reason why a "" format string _should_ generate a warning? Right, MartinS