Subject: Re: main return...
To: None <current-users@NetBSD.ORG>
From: Ty Sarna <tsarna@endicor.com>
List: current-users
Date: 03/27/1996 18:22:35
In article <199603262111.QAA13455@jekyll.piermont.com>,
Perry E. Metzger <perry@piermont.com> wrote:
> 
> Ty Sarna writes:
> > Still though, void main in "hosted" (~= userland) programs is SO common
> > that the standard might as well be changed to allow it.
> 
> Many bad practices are common. A compiler warning or two and thirty
> seconds hacking one time too many will retrain people. I was a bit
> unclear on this point once, but a vicious compiler taught me the right
> thing.

But my point is, void main() is (and I wish I could think of the Latin
phrases for these) "wrong because it's prohibited", not "wrong in and of
itself". If the standard were to have been written:
	
	"... In addition, the return type of main() may be void, however
	 the result falling off the end of a void main is undefined, and
	 compilers should produce a warning if that possibility is
	 detected". 

there would be nothing wrong with that practice, or with the standard. 
"main should return int" is an arbitraty design decision, not a law of
the universe, in other words.  Just like ANSI C says you can't have 0
sized arrays.  Using a zero-sized array is only wrong because the
standard says they're not allowed to, not because there's actually a real
reason why that's wrong.  In fact, they can be useful, which is why GCC
allows them as an extension.  It's still wrong to use them in code that
you intend to be portable, but only because the standard says you can't.

BTW, Peter pointed out to me privately that Plan 9 C *requires* void
main(), which shows that it's a merely a design choice and not something
inherently good or evil.