public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Laurent Dufréchou" <laurent.dufrechou@gmail.com>
To: "'Tom Browder'" <tom.browder@gmail.com>
Cc: "'Sven Eschenberg'" <eschenb@cs.uni-frankfurt.de>,
	"'Laurent Dufréchou'" <laurent.dufrechou@gmail.com>,
	gcc-help@gcc.gnu.org
Subject: RE: G++/GCC not detetcing stupid errors in code.
Date: Thu, 22 May 2008 12:09:00 -0000	[thread overview]
Message-ID: <48355ef3.1358560a.6a9d.0fc9@mx.google.com> (raw)
In-Reply-To: <8bc817ee0805220400y390d8138s91447dbeeaaf847d@mail.gmail.com>

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

  reply	other threads:[~2008-05-22 11:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22  8:56 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48355ef3.1358560a.6a9d.0fc9@mx.google.com \
    --to=laurent.dufrechou@gmail.com \
    --cc=eschenb@cs.uni-frankfurt.de \
    --cc=gcc-help@gcc.gnu.org \
    --cc=tom.browder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).