delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/29/15:28:13

Message-Id: <3.0.16.19971029215033.35b7c09c@hem1.passagen.se>
Date: Wed, 29 Oct 1997 22:25:06 -0500
To: firewind <firewind AT metroid DOT dyn DOT ml DOT org>
From: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>
Subject: Re: Reading the command line
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0

At 07.06 1997-10-29 GMT, you wrote:
>Peter Palotas <blizzar AT hem1 DOT passagen DOT se> wrote:
>> Howcome this is such a debated issue?  Let the people who doesn't want to
>> return anything do so if that makes them happy.  A program will compile
>> anyway, even if main isn't declared to return an int, possibly with a
>> warning, but sometimes not even that (depending on what compiler you use).
>> Personally I always declare main to return an integer since this is the
>> right thing to do, but it isn't neccessary as far as I can see, if you
>> don't want to return anything from main().
>
>If you allow 'void main()' to be valid, you also allow 'if(1 + 1 == 3)' to be
>a true comparison.
>
>The standard says main() shall return int, and so int it shall return.

If this is so, why doesn't the compiler generate an error for declaring
main() as 'void main()'?

-- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se --

*****************************************************
* A brief description of DJGPP:                     *
* NEVER BEFORE HAS SO FEW DONE SO MUCH FOR SO MANY! *
*****************************************************

- Raw text -


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