Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Sep 1996 12:48:37 +0300 (EET DST)
From:      Narvi <narvi@haldjas.folklore.ee>
To:        "Daniel O'Callaghan" <danny@panda.hilink.com.au>
Cc:        Zach Heilig <zach@blizzard.gaffaneys.com>, Paul DuBois <dubois@primate.wisc.edu>, "Kevin P. Neal" <kpneal@pobox.com>, hackers@FreeBSD.org
Subject:   Re: void main
Message-ID:  <Pine.BSF.3.91.960904124446.8796A-100000@haldjas.folklore.ee>
In-Reply-To: <Pine.BSF.3.91.960904193041.2133C-100000@panda.hilink.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help


On Wed, 4 Sep 1996, Daniel O'Callaghan wrote:

> 
> 
> On 4 Sep 1996, Zach Heilig wrote:

[snip]

> 
> Well, if you do
> int main(void)
> {
> 	printf("Hello world\n");
> }

And you *never* should end a function with only a closing braket. 
*Allways* use return (or exit()). I know at least one C compiler that 
will always complain (or even generate not too right) code if you do 
so. 

> 
> and compile with gcc -Wall, gcc will complain about reaching the end of a 
> non-void function.  Declaring main() to be void will remove that warning.
> I use void main(void){...} a lot.
> 

Me too. But for test programs of no more than 1 pg in lenght. If they 
start to be longer, being correct is worth the effort.

	Sander

> Danny
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.960904124446.8796A-100000>