delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/30/15:16:05

From: cwalsh AT nf DOT sympatico DOT ca (Colin Walsh)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Reading the command line
Date: 29 Oct 97 03:59:42 GMT
Organization: Colossal Software
Lines: 31
Distribution: world
Message-ID: <3456b4ae.0@204.101.95.15>
References: <62pk3q$3q$1 AT panther DOT rmplc DOT co DOT uk> <34505783 DOT 3DE3 AT swcp DOT com> <3450663B DOT 4202 AT rug DOT ac DOT be> <62q0ic$73f$1 AT panther DOT rmplc DOT co DOT uk> <345088C1 DOT E26 AT rug DOT ac DOT be> <34568B58 DOT 7B61 AT swcp DOT com>
Reply-To: cwalsh AT nf DOT sympatico DOT ca
NNTP-Posting-Host: 204.101.95.15
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <34568B58 DOT 7B61 AT swcp DOT com>
"H.W. Stockman" <hwstock AT swcp DOT com> wrote:

> Vik Heyndrickx wrote:
>> 
>> 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!
>> 
>> The standard tells that the return type of main is int and not void.
> 
> Many compilers will gleefully let you declare
> void main(){}
> ...without a single complaint.  However, the consequences
> of mixing order of argc and argv[] are likely to be
> more significant.

Actually, if you use the -Wall switch when compiling it tells you:
warning: return type for `main' changed to integer type
So, the compiler realizes your mistake and fixes it for you, but I
still think that one should go with the standard (I will admit
that up until recently I've been using void main() :)

Just rambling,
Colin Walsh
cwalsh AT nf DOT sympatico DOT ca


- Raw text -


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