From owner-freebsd-hackers Wed Sep 4 03:00:04 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id DAA04568 for hackers-outgoing; Wed, 4 Sep 1996 03:00:04 -0700 (PDT) Received: from haldjas.folklore.ee (Haldjas.folklore.ee [193.40.6.121]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id CAA04344 for ; Wed, 4 Sep 1996 02:54:47 -0700 (PDT) Received: (from narvi@localhost) by haldjas.folklore.ee (8.6.12/8.6.12) id MAA09707; Wed, 4 Sep 1996 12:48:37 +0300 Date: Wed, 4 Sep 1996 12:48:37 +0300 (EET DST) From: Narvi To: "Daniel O'Callaghan" cc: Zach Heilig , Paul DuBois , "Kevin P. Neal" , hackers@FreeBSD.org Subject: Re: void main In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk 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 >