From owner-freebsd-hackers Sat May 31 20:21:52 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id UAA02322 for hackers-outgoing; Sat, 31 May 1997 20:21:52 -0700 (PDT) Received: from iceberg.anchorage.net. (root@iceberg.anchorage.net [207.14.72.150]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id UAA02317 for ; Sat, 31 May 1997 20:21:48 -0700 (PDT) Received: from aak.anchorage.net (ai-131 [207.14.72.131]) by iceberg.anchorage.net. (8.6.11/8.7.3) with SMTP id SAA01528; Sat, 31 May 1997 18:18:10 -0800 Date: Sat, 31 May 1997 19:10:53 -0800 (AKDT) From: Steve Howe X-Sender: abc@aak.anchorage.net To: "Kevin P. Neal" cc: freebsd-hackers Subject: Re: Borland 16bit bcc vs cc/gcc (float) In-Reply-To: <1.5.4.32.19970531220152.008b46f0@mindspring.com> 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 Sat, 31 May 1997, Kevin P. Neal wrote: > >ahhh! :) everyone says this - but exit() never returns, so main > >never returns anything, so IMHO, main should always be type void. > Who says you always have to use exit()? i'm sorry, i meant if you use exit. i spent alot of time writing BIOS's for embedded systems where i had to sqeeze out every meaningless opcode, and i found that if return codes generate quite a few opcodes, which is a waste if your bootstrapping and jumping to an OS which will create it's own stack. further, from what i gather, it's good to call exit() on a real OS when you finish a program in case there a hidden/extraneous clean-up functions that need to be completed. and since exit doesn't return to main, any return in main is a waste of code. it might also give someone the wrong idea that main actually does return something. > In fact, I've observed C++ code that never calls the destructors if you > exit() of out a program. > > This is one of my favorite rants. I gave a friend of mine the 15 minute > explanation of why void main() is wrong, and he told his instructor. She > placed him out of her class and into the next one up. i'm just saying it's not an absolute. ------------------------------------------------------------------------- Sleep: a sign a caffeine deprivation ... http://www.anchorage.net/~un_x -------------------------------------------------------------------------