Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 May 1997 18:01:52 -0400
From:      "Kevin P. Neal" <kpneal@pobox.com>
To:        Steve Howe <un_x@anchorage.net>
Cc:        freebsd-hackers <hackers@FreeBSD.ORG>
Subject:   Re: Borland 16bit bcc vs cc/gcc (float)
Message-ID:  <1.5.4.32.19970531220152.008b46f0@mindspring.com>

next in thread | raw e-mail | index | archive | help
At 12:03 PM 5/31/97 -0800, Steve Howe wrote:
>
>On Sat, 31 May 1997, J Wunsch wrote:
>
>> > void main           (unsigned char argc, unsigned char **argv) {
>
>> Don't get caught in comp.lang.c with this. :)  It's an invalid
>> definition of main, thus the behaviour is implementation-dependant.
>> gcc could have exited immediately without violating the standard.
>
>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()?

In fact, I've observed C++ code that never calls the destructors if you
exit() of out a program.

All of my programs return(0); out of main(). After all, main() is not
special in any way, other than being the conventional entry point of user
written code. If you wanted to write your own entry code (crt0.o or whatever)
you wouldn't even need main(). I've seen AmigaDOS programs that had no
main(). 

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. 
--
XCOMM Kevin P. Neal, Junior, Comp. Sci.     -   House of Retrocomputing
XCOMM  mailto:kpneal@pobox.com              -   http://www.pobox.com/~kpn/
XCOMM  kpneal@eos.ncsu.edu              Spoken by Keir Finlow-Bates:
XCOMM "Good grief, I've just noticed I've typed in a rant. Sorry chaps!"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1.5.4.32.19970531220152.008b46f0>