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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] De la
part de Tom Browder
Envoyé : jeudi 22 mai 2008 13:00
À : Laurent Dufrechou
Cc : Sven Eschenberg; Laurent Dufréchou; gcc-help@xxxxxxxxxxx
Objet : Re: G++/GCC not detetcing stupid errors in code.

On Thu, May 22, 2008 at 4:00 AM, Laurent Dufrechou
<laurent.dufrechou@xxxxxxx> 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux