Re: Why no segmentation fault
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Tue, 28 Mar 2006 06:36:46 GMT
"santosh" <santosh.k83@xxxxxxxxx> writes:
Eric Sosman wrote:[...]
Okay, I conceed that exotic systems like VMS might accept numerous
return values as condition codes. But still, 0 and EXIT_SUCCESS
*should* mean the same thing. If not then the system/library is
second-guessing the programmer. Other implementation specified macros
could be defined for indicating various types of sucesses and failures
but EXIT_SUCCESS and 0 should mean the same thing.
The host environment can assign any meaning to any particular return
value as it is not constrained by the C standard, but the C library
should ensure that 0 and EXIT_SUCCESS, as well as EXIT_FAILURE, are
mapped to the host recognised values for successful termination and
unsuccessful termination in the respective cases.
IMHO, a cleaner solution would have been for the C standard to specify
only EXIT_SUCCESS and EXIT_FAILURE as portable exit codes, leaving the
behavior of both 0 and 1 unspecified.
In the Unix world that gave birth to C, 0 means success, and non-zero
(particularly 1) means failure. The C standard chose to require 0 to
mean success on all systems, which, as we've seen, caused problems for
VMS.
On the other hand, if only EXIT_SUCCESS and EXIT_FAILURE were defined,
then almost all programs would have to have a "#include <stdlib.h>" to
see the definitions -- and all pre-ANSI code would have become
non-portable.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- Follow-Ups:
- Re: Why no segmentation fault
- From: Eric Sosman
- Re: Why no segmentation fault
- From: CBFalconer
- Re: Why no segmentation fault
- References:
- Why no segmentation fault
- From: Christian Christmann
- Re: Why no segmentation fault
- From: santosh
- Re: Why no segmentation fault
- From: Keith Thompson
- Re: Why no segmentation fault
- From: santosh
- Re: Why no segmentation fault
- From: Keith Thompson
- Re: Why no segmentation fault
- From: santosh
- Re: Why no segmentation fault
- From: Mark McIntyre
- Re: Why no segmentation fault
- From: Keith Thompson
- Re: Why no segmentation fault
- From: Mark McIntyre
- Re: Why no segmentation fault
- From: Eric Sosman
- Re: Why no segmentation fault
- From: santosh
- Why no segmentation fault
- Prev by Date: Re: Need help on string manipulation
- Next by Date: Re: arrays question
- Previous by thread: Re: Why no segmentation fault
- Next by thread: Re: Why no segmentation fault
- Index(es):
Relevant Pages
|