gcc vs g++ format string warning question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I've got a very simple test program:

#include <stdio.h>
int main(int argc, char** argv)
{
  printf("%s $s\n", "foo", "bar");
  return 0;
}

which resulted from a typo in a format string ($s instead of %s).
Logic would say that this would result in a warning about the format
string having too many arguments, and using gcc (3.3.2) it does:

> gcc -Wall -Werror -o try-too-many try-too-many.c
try-too-many.c: In function `main':
try-too-many.c:5: warning: too many arguments for format
>

however, using g++ (also 3.3.2), there is no warning:

> g++ -Wall -Werror -o try-too-many try-too-many.c
>

I just tried this again with gcc/g++ 3.4.0 and both produce the
expected warning.  Is this a bug in 3.3.2, or is there another warning
I need to enable for g++?

please cc any replies to me as I'm not subscribed.

Thanks,

Scott Lipcon


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux