This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
G++/GCC not detetcing stupid errors in code.
- From: Laurent Dufréchou <laurent dot dufrechou at gmail dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 22 May 2008 10:16:25 +0200
- Subject: G++/GCC not detetcing stupid errors in code.
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