Tomas,

This bug has been fixed in Oracle Solaris Studio 12.2. However, the given test case will still get a lint warning for the printf. The reason is that "wc" expects an 'int' argument but is given a 'long' argument (wchar_t is a typedef'd long). You'd get the same warning if, for example, you used "%c" and supplied a 'long' argument.

--Dave

Hi,

lint main.c reports:
malformed format string
    fprintf             main.c(8)

// main.c
#include <wchar.h>
#include <stdio.h>

int main(int argc, char* argv[])
{
    wchar_t SI='A';

    (void) fprintf(stdout, "%wc\n", SI);

    return 0;
}
//

but the printf(3s) manpage documents the wc conversion specifier:
     wc      The int argument is converted to  a  wide  character
             (wchar_t),  and  the  resulting  wide  character  is
             printed.

Where is the error?

Tomas Klacko
_______________________________________________
tools-compilers mailing list
[email protected]
_______________________________________________
tools-compilers mailing list
[email protected]

Reply via email to