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

Date: Wed, 29 Oct 1997 13:16:11 -0500 (EST)
From: "Art S. Kagel" <kagel AT ns1 DOT bloomberg DOT com>
Reply-To: kagel AT ns1 DOT bloomberg DOT com
To: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>
Cc: kagel AT ns1 DOT bloomberg DOT com, djgpp AT delorie DOT com
Subject: Re: Reading the command line
In-Reply-To: <3.0.16.19971029005208.1b97170c@hem1.passagen.se>
Message-Id: <Pine.D-G.3.96.971029130819.16585B-100000@dg1>
Mime-Version: 1.0

On Wed, 29 Oct 1997, Peter Palotas wrote:

> At 11.15 1997-10-28 -0500, you wrote:
> >On Fri, 24 Oct 1997, Jon Seanor wrote:
> >
> >> >And the return type of main is int, not void. That should be in any text
> >> >book too.
> >> 
> >> 
> >> Only if you want to return something!
> >
> >WRONG! WRONG! WRONG! WRONG! WRONG! WRONG! WRONG! WRONG! WRONG! WRONG!
> >
> >Function main() MUST ALWAYS RETURN INT and MUST ALWAYS END WITH A RETURN 
> >statement!  The startup code will be returning the value at the top of the
> >stack whether you like it or not, this is required by C convention, the C
> >standard, and most modern operating systems.  If you do not want to return
> >anything useful return zero(0), but you must return something or the OS
> >status code (ERRORLEVEL in DOS) for the task will be garbage.
> 
> 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().

Look you do not have to wear shoes while walking on the street or a condom
while having sex with a new acquaintance and most of the time nothing bad
will happen in either case, but when it does it can be anything from dirty
feet or easily cured clap to a raging tetanus infection or AIDS!  Similarly
if you return nothing usually nothing happens but one day something EVIL
will surely happen.  Me, not only do I always wear shoes but I always
recommend that others wear shoes.  What good is experience and knowledge if
we do not share it!  What would Einstein have accomplished if Newton,
Currie and others had died in silence?  RANT RANT OK I'm done.

Art S. Kagel, kagel AT bloomberg DOT com

- Raw text -


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