delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/21/21:51:59

Message-Id: <199809220156.CAA06623@rochefort.ns.easynet.net>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: "George Foot" <george DOT foot AT merton DOT ox DOT ac DOT uk>
To: sl AT psycode DOT com DOT REMOVE_THIS
Date: Tue, 22 Sep 1998 02:49:06 +0000
MIME-Version: 1.0
Subject: Re: DJGPP/GCC bug found
Reply-to: mert0407 AT sable DOT ox DOT ac DOT uk
CC: djgpp AT delorie DOT com

On 22 Sep 98 at 0:54, sl AT psycode DOT com DOT REMOVE_THIS wrote:

> On Sun, 13 Sep 1998 23:55:49, "Martin Ambuhl" <mambuhl AT tiac DOT net> 
> wrote:
> 
> > | In the above example, the compiler complains "return;" is used in a
> > |case where "main()" is non-void.. But as you can see, it IS declared
> > |to return void!
> > 
> > And illegally so.  g++ is smart enough to replace your illegal 'void'
> > with the
> > _required_ 'int'.
> 
> 	It's one thing to complain "main() must return int".. It's a totally 
> other matter when GCC complains of
> an error _IT_ causes .. What I mean by this is that it makes a 
> modification without telling me about it, therefore
> the error message which follows only serves to confuse the user.. Not 
> aid them ..

Always pass the `-Wall' switch.  If you do, then gcc will tell
you when it changes `main' to return `int'.  In any case, it
did tell you only a line or two earlier that it was in
function "int main (...)" -- at least it does so on my system.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019