Subject: Re: main return...
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 03/21/1996 06:59:42
>> Would anyone *object* to enabling the gcc hack for detecting invalid
>> return types from main, and returning 0 automatically if [it trips]?
> If this is an added warning, then I'm actually all for it. I'd even
> suggest returning NON-zero to make the error even more glaringly
> obvious.
Why just return nonzero? Why not call abort()? I had a program (a
much-hacked-upon emacs) that returned a random value, usually nonzero,
from main for _years_ before I noticed. The only symptom was that
SunOS crontab(1) would silently refuse to install my modified crontabs,
and I had no idea why that was happening. Only when I used it with
NetBSD's crontab(1) did I notice, because it _does_ print a complaint
explaining why it's not installing the new crontab.
der Mouse
mouse@collatz.mcrcim.mcgill.edu