Subject: Re: main return...
To: None <current-users@NetBSD.ORG>
From: Waldi Ravens <>
List: current-users
Date: 03/25/1996 19:12:03
der Mouse wrote:

> After all, until this discussion came up, I thought "void main(void);"
> was one of the allowed declarations for main, and quite a lot of my
> code is written that way.

There are lots of cases where "void main(void);" is allright. For
example when the program never exits in a normal fashion, or if
the program only exits via a direct or indirect _exit() call.

OTOH I would consider "void main(void) { return; }" an erroneous
program, unless this exiting software :-) were written for some
non-unix environment where programs do not pass an exit status
to their parent. If someone would want to patch gcc in a way that
it would detect this case and provide a warning (optionally, of
course), I wouldn't object. But I doubt it's worth the hassle.

I do object, however, against gcc silently providing a zero exit
status, if the exit status of the program would otherwise be
undefined (garbage).