public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Laurent Dufréchou" <laurent.dufrechou@gmail.com>
To: "'Andrew Haley'" <aph@redhat.com>
Cc: "'Tom Browder'" <tom.browder@gmail.com>,
		"'Sven Eschenberg'" <eschenb@cs.uni-frankfurt.de>,
		<gcc-help@gcc.gnu.org>
Subject: RE: G++/GCC not detetcing stupid errors in code.
Date: Thu, 22 May 2008 18:38:00 -0000	[thread overview]
Message-ID: <483565e4.1358560a.6aff.0ae6@mx.google.com> (raw)
In-Reply-To: <48356270.1020303@redhat.com>

>No, it's your knowledge of C++, etc...
>Note that this is a difference between C and C++: in C you must have
>a return value.

Ok! Good, so there is no error in the code due to forced return 0 all is ok
now :)
Will read :
http://www.hep.wisc.edu/~pinghc/isocppstd/basic.html

Thx for the support,
Laurent

-----Message d'origine-----
De : Andrew Haley [mailto:aph@redhat.com] 
Envoyé : jeudi 22 mai 2008 14:09
À : Laurent Dufréchou
Cc : 'Tom Browder'; 'Sven Eschenberg'; gcc-help@gcc.gnu.org
Objet : Re: G++/GCC not detetcing stupid errors in code.

Laurent Dufréchou wrote:
> 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 :)

No, it's your knowledge of C++.

ISO/IEC 14882:1998(E)
3.5 Program and linkage

"A return statement in main has the effect of leaving the main
function (destroying any objects with automatic storage duration) and
calling exit with the return value as the argument. If control reaches
the end of main without encountering a return statement, the effect is
that of executing

return 0;"

Note that this is a difference between C and C++: in C you must have
a return value.

Andrew.

  reply	other threads:[~2008-05-22 12:24 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
2008-05-22 12:23         ` Andrew Haley
2008-05-22 18:38           ` Laurent Dufréchou [this message]
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=483565e4.1358560a.6aff.0ae6@mx.google.com \
    --to=laurent.dufrechou@gmail.com \
    --cc=aph@redhat.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).