Eventuali duplicati:
Can I make GCC warn on passing too-wide types to functions?Differenza tra -Wconversion tra il gcc e g ++
Si consideri il seguente programma di test:
static void func(int a)
{
}
int main()
{
unsigned int b = 42;
func(b);
return 0;
}
compilazione con gcc:
[email protected]:~/projects$ gcc -Wconversion testit.c testit.c: In function âmainâ: testit.c:11: warning: passing argument 1 of âfuncâ as signed due to prototype [email protected]:~/projects$
Ma, in g ++ non c'è nessun avvertimento !:
[email protected]:~/projects$ g++ -Wconversion testit.c [email protected]:~/projects$
Qual è la ragione di questo e non v'è alcun modo per ottenere lo stesso avviso quando si compila il codice C++?