You are looking for -Wconversion I guess.
Implicit conversion are a nice thing to have ;-).
Regards
-Sven
Laurent Dufréchou schrieb:
Hi there,
I’m using g++ for the first time via gcc 4.1.2.
I’ve written a little code (first C++ oriented and because guys with which I
work come from C, it is slightly modified to compile with G++ and gcc)
Code >>>>>>>>>>>>>>>>>>>>>>>>>>>>
//#include <iostream>
#include <stdio.h>
//using namespace std;
int main()
{
int toto;
short tata;
toto = 1111118;
tata = toto; //error 1!
//cout << toto << "tata:" << tata << endl;
printf("%d %i",toto,tata);
//return 0; //error 2 because no return
}
I i compile with gcc (cc), it detects no int returned error (OK good point)
But the downcast (tata = toto) doesn’t raise any warning!
If I use G++ the downcast is not detected and even more the return is not
also detected (!)
I was thining that Gcc was really strict and I choose it because I was
thinking that, I’m quite disappointed :/
I’ve tried –Wall –Wextra –pedantic + a ton of other switch with no luck…
Do i miss something ?
How can I put Gcc in “user is stupid I need to check all” mode?
Laurent