This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: G++/GCC not detetcing stupid errors in code.


Yeah compiling with g++-4.3 solved the issue of downcasting. I've now a big
warning :) COOL!
Thanks Tom.
Any idea about the (not so worrying) no return in function requesting
return?
Gcc detect it but not g++. 
Perhaps I miss another keyword???

If you've got no idea, I will fill a bug report :)

Lauennt (code below)

//#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 <-----------------

}

-----Message d'origine-----
De?: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] De la
part de Tom Browder
Envoyé?: jeudi 22 mai 2008 13:00
À?: Laurent Dufrechou
Cc?: Sven Eschenberg; Laurent Dufréchou; gcc-help@gcc.gnu.org
Objet?: Re: G++/GCC not detetcing stupid errors in code.

On Thu, May 22, 2008 at 4:00 AM, Laurent Dufrechou
<laurent.dufrechou@free.fr> wrote:
> Arf no... Here is my compile option :)
>
> g++ -march=nocona -Wall -Wfloat-equal -Wshadow -Wpointer-arith
-Wcast-align
> -Wcast-qual -Wconversion -Wextra -Wreorder -Wold-style-cast -Winit-self

The failure to warn about the downcast may be a known problem.  I had
a problem the other way on a later version of gcc, and the gcc-dev
list has some threads about such.

I suggest checking bugzilla and also check at least gcc version 4.3.

-Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]