main() arguments, was Re: typedef-ing an array

Kaleb Keithley kaleb at mars.jpl.nasa.gov
Fri Jul 6 04:06:43 AEST 1990


In article <2160 at polari.UUCP> 6sigma2 at polari.UUCP (Brian Matthews) writes:
>In article <4241 at jato.Jpl.Nasa.Gov> kaleb at mars.UUCP (Kaleb Keithley) writes:
>|void main () { exit(0); printf("I'll never be printed\n"); }
>
>In general, trying an example that happens to work one way on one compiler
>shouldn't be convincing.
>
>In this case, proof (for ANSI C) would consist of quoting the standard
>where it says "The exit function cannot return to its caller."

Well, I tried it on as many compilers as I could get my hands on, and they
all worked.  I'd call that *empirical* proof.  As opposed to the other,
which walk, talks, and smells like a theoretical proof.  In the world where
I work, the doc's, standards, and manuals frequently say one thing, while
the actual tool does something else.  So I've come to rely on not taking
"...the book says..." as gospel.

Don't get me wrong, I support the standard, even though I have shown that
I'm not very familiar with it.  (I learned something in this little exchange
also!) 

It also strikes me that what may be missing from the standard is a statement
along the lines of "... use of exit() from main() is illegal..."  Not to 
mention that K&R2 is a little misleading in this area also.

kaleb at thyme.jpl.nasa.gov            Jet Propeller Labs
Kaleb Keithley

"So that's what an invisible barrier looks like"



More information about the Comp.lang.c mailing list