This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Another exit codes question


On Fri, Mar 02, 2001 at 11:32:18AM -0500, Michael Meissner wrote:
> On Thu, Mar 01, 2001 at 10:45:11PM -0800, Zack Weinberg wrote:
> > I need to know which of these system triples do and do not define the
> > C89 EXIT_SUCCESS and EXIT_FAILURE macros.  Of those that do define
> > them, I need to know if any get them wrong.  ("Wrong" means "fails to
> > convey the appropriate information to the invoking process.")  Of
> > those that don't define them, I need to know whether or not 0==success
> > and 1==failure are appropriate as the argument to exit(3) or return
> > from main.
> > 
> > alpha*-dec-vms*
> > vax*-*-vms*
> > i370-*-opened*
> > i370-*-mvs*
> > i370-*-linux*
> > 
> > These are the system triples with "unusual" definitions of
> > SUCCESS_EXIT_CODE and/or FATAL_EXIT_CODE, in case anyone is curious.
> 
> EXIT_FAILURE and EXIT_SUCCESS were added to the ISO C89 standard to cope with
> VMS, which had a standard encoding for exit returns, that included whether to
> print the message, an error code, etc..  IIRC, the bottom bit was set to
> suppress warning from decoding the exit return.

Right.  The existing definitions for SUCCESS_EXIT_CODE and
FATAL_EXIT_CODE on VMS are

#define SUCCESS_EXIT_CODE 1
#define FATAL_EXIT_CODE (44 | 0x10000000)  /* Abort, and no DCL message.  */

On the i370 triples, it's

#define SUCCESS_EXIT_CODE 0
#define FATAL_EXIT_CODE 12

What I'm trying to find out is whether we can rely on the system-
provided definitions of EXIT_SUCCESS and EXIT_FAILURE on these systems
rather than know what they have to be ourselves.  I'm fairly sure that
vax-vms is a pre-C89 host, but alpha-vms shouldn't be, and I don't
know anything about mainframes.  (Well, presumably i370-*-linux uses
the Unix "nonzero is error" convention, which means FATAL_EXIT_CODE of
12 is odd but harmless.)

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]