main return value

Doug Gwyn gwyn at smoke.brl.mil
Mon May 13 17:24:56 AEST 1991


In article <memo.1010816 at lynx.northeastern.edu> cschmidt at lynx.northeastern.edu writes:
>What value should the standard function MAIN return?

If main returns at all, it returns an int.  It should be so declared.

>3.  Declare the MAIN return type as INT and terminate the function
>    with the line "return EXIT_SUCCESS".  The problem with this is
>    that EXIT_SUCCESS is zero, even in the VAX version, and when a VMS
>    program terminates and returns zero to VMS, VMS displays the
>    system message for status code zero.  (The universal status code
>    for success in VMS is one, not zero.)

If your VMS C compiler really has this bug, get the vendor to fix it.
The DEC representative to X3J11 agreed than VMS C would map a 0 exit
status value to SYS$SUCCESS (an odd number, probably 1) before
handing in back to the invoking environment.  The EXIT_* macros were
introduced primarily as a political compromise to accommodate VMS C.



More information about the Comp.lang.c mailing list