Subject: Re: main return...
To: None <current-users@NetBSD.ORG>
From: Peter Seebach <seebs@solon.com>
List: current-users
Date: 03/29/1996 05:59:55
Yes, the standard really does say that void main is not allowed.  What's
odd about it?  crt0 is built with no reference to your code, and is
built to use the return from main.  There's no way to find out whether
main returned a value or not, so there's nothing crt0 can do to debug
this.  It could probably be done with excessive linker magic, but it
would be pretty hassle-intense.

You will notice that, directly across from the page that defines main,
"The Annotated ANSI C Standard" claims that "void main(void)" is allowed
(but does *not* claim that void main(int, char **) is allowed...).  This
has earned the author the undying hatred (or at least peevishness) of
the entire standard committee.

And the envp parameter is moderately deprecated, now replaced by extern
char **environ.

(Obviously, C doesn't allow it, but it's mentioned as a common extension.)

-s