Extend format string checking to const string variables

Lakshmankumar Mukkavilli lakshman@cisco.com
Mon Apr 15 06:05:00 GMT 2002


This is not a bug but a suggestion for better diagnostics.

Here is my test program.

const char * fs="%s\n";
void mm (int a)
{
    printf(fs,a);
    printf("%s\n",a);
}

I am using gcc 3.0. When compiled with -Wall I get a warning for
printf("%s\n",a) but not for printf(fs,a).

It would be useful to see a warning when const string variables are used 
for specifying format.

Regards,
Lakshmankumar Mukkavilli
lakshman@cisco.com



More information about the Gcc-bugs mailing list