Duplicar posibles:
Can I make GCC warn on passing too-wide types to functions?Diferencia entre -Wconversion entre gcc y g ++
Considérese el siguiente programa de prueba:
static void func(int a)
{
}
int main()
{
unsigned int b = 42;
func(b);
return 0;
}
Compilar 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$
Pero, en g ++ No hay ninguna advertencia !:
[email protected]:~/projects$ g++ -Wconversion testit.c [email protected]:~/projects$
¿Cuál es la razón de esto y hay alguna manera de conseguir la misma advertencia al compilar código C++?