Must main return a value?

Stephen Clamage steve at taumet.com
Sat Jun 29 02:46:19 AEST 1991


michi at ptcburp.ptcbu.oz.au (Michael Henning) writes:

>The upshot is that the program is strictly conforming, but the exit
>status the OS gets to see is undefined.

No.  A strictly-conforming program "shall not produce output dependent
on any unspecified, undefined, or implementation-defined behavior"
(section 1.7).

>So it pays to write
>int main(void) { exit(0); }

Except that EXIT_SUCCESS need not have the value 0.  This might be
wrong in an ANSI environment.
-- 

Steve Clamage, TauMetric Corp, steve at taumet.com



More information about the Comp.std.c mailing list