Subject: Re: main return...
To: Peter Seebach <email@example.com>
From: Scott Reynolds <scottr@Plexus.COM>
Date: 03/26/1996 09:18:53
On Mon, 25 Mar 1996, Peter Seebach wrote:
> No, there are *not* cases in which it is all right; it is invalid
> standard C.
It is not portable. However, it doesn't break on any UN*X system I am
aware of, either (or anything reasonably close, but I don't have an account
on a Cray anywhere). The compiler should warn, or perhaps give an error,
if it's told to be pedantic.
> I do not object to a silent 0 exit status; this is explicitly allowed
Now, I do object to this. I would rather have a silent 1 exit status.
Otherwise, we encourage one kind of brokenness (relying on falling off
the end giving a "success" status) even as we discourage another.
And having said that, the standard allows for the current behavior. We
aren't tied to gcc, and hacking on it can make life rough for those
people/ports that aren't using it (or can't). If we're going to change
something, I've come to the conclusion that it's only appropiate to make
the compiler complain. Changing the code generated is probably unwise
given that there's no compelling reason to do so.
PS - Perhaps I missed this in the thread somewhere, but it's significant
to note that gcc -ansi -pedantic doesn't complain about void main(void).
This is certainly a gcc bug.