public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* G++/GCC not detetcing stupid errors in code.
@ 2008-05-22  8:56 Laurent Dufréchou
  2008-05-22  9:00 ` Sven Eschenberg
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent Dufréchou @ 2008-05-22  8:56 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-06-09  0:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22  8:56 G++/GCC not detetcing stupid errors in code Laurent Dufréchou
2008-05-22  9:00 ` Sven Eschenberg
2008-05-22 10:53   ` Laurent Dufrechou
     [not found]   ` <-457754682823264016@unknownmsgid>
2008-05-22 11:55     ` Tom Browder
2008-05-22 12:09       ` Laurent Dufréchou
2008-05-22 12:23         ` Andrew Haley
2008-05-22 18:38           ` Laurent Dufréchou
2008-05-22 12:24         ` Axel Freyn
2008-06-09  0:44           ` Christopher Layne
2008-05-23  2:16         ` Tom Browder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).