www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/17/19:44:15

From: Leath Muller <leathm AT gbrmpa DOT gov DOT au>
Message-Id: <199606172335.JAA19148@gbrmpa.gov.au>
Subject: Re: Help Beginning
To: djgpp AT delorie DOT com
Date: Tue, 18 Jun 1996 09:35:19 +1000 (EST)
In-Reply-To: <199606170547.AA267780439@relay1.geis.com> from "j.aldrich6@genie.com" at Jun 17, 96 05:16:00 am

> >#include <iostream.h>
> >void main()
 
> DO NOT USE VOID MAIN()!!!  This is just plain BAD programming.
> For the last time, it's INT MAIN()!  The return value of main() is the
> value your program returns to the operating system, and you really
> need to specify this, regardless of anything else you plan to do.
> BTW, return 0; is the standard way to tell DOS (et.al.) that your
> program ran ok.

Actually, I was taught this at the end of second year uni...the theory was
something like:
	When you return to the OS after exiting from your program, you may
	send a void as void essentially translates into a numeric zero.
As far as I know, void is undefined, not zero...so there you go, uni lecturers
are sometimes wrong... :)
 
> Sorry for the steam, but we've had this discussion here before.  :)
> Question for you:  Where'd you learn to use 'void main()'?  From
> a book or a teacher?  Whichever it is, I'd recommend that you
> slow roast it/him/her.  :)

Nah, then you would be in hot oil... ;)

Leathal.

- Raw text -


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