It was thus said that the Great Alfred M. Szmidt once stated:
It was thus said that the Great Noel Chiappa via
cctalk once stated:
From:
Alfred M. Szmidt
No even the following program:
int main (void) { return 0; }
is guaranteed to work
I'm missing something: why not?
Yeah, I'm having a hard time with that too. I mean, pedantically, it
should be:
#include <stdlib.h>
int main(void) { return EXIT_SUCCESS; }
Pedantically, it does not matter -- a return from main is equivalent
to an exit(), and exit(0) is sensibly defined, and EXIT_SUCCESS can
also be different from 0 (even though I don't think such a platform
exists).
Similiarly for EXIT_FAILURE ...
):
Somebody asked about OpenVMS. I haven't used it in a long time, but
as I recall odd status values generally denote success while even
values denote failure. The C implementation maps 0 to 1, so that
return 0; indicates successful termination. Other values are passed
unchanged, so return 1; also indicates successful termination.
EXIT_FAILURE would have a non-zero even value.
And certainly VMS is on topic for this list.
-spc (So ... pedantically speaking, who's correct?)