From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26762 invoked by alias); 22 May 2008 08:56:36 -0000 Received: (qmail 26750 invoked by uid 22791); 22 May 2008 08:56:35 -0000 X-Spam-Check-By: sourceware.org Received: from hera.rbi.informatik.uni-frankfurt.de (HELO hera.rbi.informatik.uni-frankfurt.de) (141.2.1.1) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 22 May 2008 08:56:15 +0000 Received: from [141.2.119.180] (fahrenheit.ghl40.whgl.uni-frankfurt.de [141.2.119.180]) by hera.rbi.informatik.uni-frankfurt.de (8.13.8/8.13.8) with ESMTP id m4M8uDLo018162; Thu, 22 May 2008 10:56:13 +0200 Message-ID: <4835353E.4000800@cs.uni-frankfurt.de> Date: Thu, 22 May 2008 09:00:00 -0000 From: Sven Eschenberg User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: =?windows-1252?Q?Laurent_Dufr=E9chou?= CC: gcc-help@gcc.gnu.org Subject: Re: G++/GCC not detetcing stupid errors in code. References: <48352be5.0c58560a.66c6.16bf@mx.google.com> In-Reply-To: <48352be5.0c58560a.66c6.16bf@mx.google.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-05/txt/msg00225.txt.bz2 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 > #include > > //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 > >