Mike Wahler said:
Floyd Davidson said:
Ben Pfaff said:
Ben Pfaff wrote:
Zygmunt Krynicki wrote:
On Fri, 03 Oct 2003 23:59:49 -0400, Al Bowers wrote:
return 0;
return EXIT_SUCCESS;
They mean the same thing.
Yes. However, they are not necessarily equal.
However, it was not a reasonable correction of the posted code.
[...]
However, Ben Pfaff is certainly teasing us with something
specific in mind, and I would like to hear him expand on it
because obviously there is more to this than I'm seeing.
Some people in the past in this newsgroup have presumed that
EXIT_SUCCESS must expand to (a constant expression with value) 0.
This is not the case. It could have the value 1, 6, 23, or
whatever other value is appropriate for the implementation.
That's all I'm trying to point out.
I've never programmed on a VMS system, so I'm not positive how
that works... ;-)
So why did you give VMS as an example in your other post?
I understand that is one example where, at least prior to ANSI
C, an exit status of 0 was not success. Perhaps my memory is
wrong?
Yes. And this contradicts what you said in your other post.
I see no contradiction with what I said, so perhaps you
misunderstood it or I didn't make it clear.
Your argument in that article came down to my use of the word
"value" which you say should have been "condition". That's just
semantics, and I think you've read more into the term "value"
than I intended. I did not mean a "numerical value", I meant a
boolean value which toggles between /successful/ /termination/
and /unsuccessful/ /termination/.
The only variation from what I described is the one Richard
Heathfield points out, where there might be multiple types of
"success". However, the C Standard doesn't support that, except
as implementation-defined, any more than it supports multiple
types of "failure" which are also implementation-defined.
§7.20.4.3
...
"If the value of status is zero or EXIT_SUCCESS, an
implementation-defined form of the status /successful/
/termination/ is returned. If the value of status is
EXIT_FAILURE, an implementation-defined form of the status
/unsuccessful/ /termination/ is returned. Otherwise the status
returned is implementation-defined."
"[t]he /status /successful/ /termination/" is singular, and
indicates both EXIT_SUCCESS and zero will be converted to the
same thing.
I agree with Ben Pfaff that EXIT_SUCCESS is not necessarily 0,
but whatever it is must be handled the same as if it were 0.
There seems to be no absolute necessity to ever define it as
other than 0 simply because, since EXIT_SUCCESS is a macro, its
conversion will be handled by the pre-processor, while 0 will be
handled later. That still doesn't mean it can't be other than
0 though.