This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc vs g++ format string warning question


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]