main() arguments, was Re: typedef-ing an array
Brian Matthews
6sigma2 at polari.UUCP
Fri Jul 6 14:01:08 AEST 1990
In article <4249 at jato.Jpl.Nasa.Gov> kaleb at mars.UUCP (Kaleb Keithley) writes:
|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.
|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.
Empirical evidence that it works on the compilers you could get your
hands on. If you want to know if something conforms to the standard or
not, your only choice is to consult the standard. Of course, as you
say, knowing something conforms to the standard is no proof that it
actually compiles correctly on any compiler.
|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!)
Good! Another happy customer :-)
|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.
But the whole point of the discussion is that an exit from main isn't
illegal and will do the same thing as a return from main (with the same
value, of course) as long as main is declared correctly.
--
Brian L. Matthews blm at 6sceng.UUCP
More information about the Comp.lang.c
mailing list