Date: Sat, 31 May 1997 19:10:53 -0800 (AKDT) From: Steve Howe <un_x@anchorage.net> To: "Kevin P. Neal" <kpneal@pobox.com> Cc: freebsd-hackers <hackers@FreeBSD.ORG> Subject: Re: Borland 16bit bcc vs cc/gcc (float) Message-ID: <Pine.BSF.3.95q.970531190322.1359C-100000@aak.anchorage.net> In-Reply-To: <1.5.4.32.19970531220152.008b46f0@mindspring.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 -------------------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.970531190322.1359C-100000>