[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug: return doesn't accept negative numbers
From: |
Linda Walsh |
Subject: |
Re: bug: return doesn't accept negative numbers |
Date: |
Sun, 07 Aug 2011 15:03:35 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 |
Bob Proulx wrote:
Linda Walsh wrote:
How about portable code using:
(exit -1); return
It's ugly, but would seem to be the portable/official way to
do this.
Exit codes should be in the range 0-255.
---
I suppose you don't realize that 'should' is a subjective opinion that
sometimes has little to do with objective reality.
It is true, that when you display a signed char, non-signed-
-extended, in a 16, 32 or 64 bit format, you see 255, and certainly, no
one (including myself) would suggest 'sign extending' an error code, as that
would make it "other than what it was". But just because it displays
only as 0-255 under most circumstances is no reason for ignoring the
implementation in all the main languages when the standard was written
as accepting signed short integers.
The same 'open group' that wrote posix wrote a C standard , and they
defined it's exit val as taking a short int as well.... So they were
inconsistent.
Bash itself is inconsistent in that it accepts exit values the same as
every other
program, but limits return values to a particular subset.
- bug: return doesn't accept negative numbers, Linda Walsh, 2011/08/05
- Re: bug: return doesn't accept negative numbers, Eric Blake, 2011/08/05
- Re: bug: return doesn't accept negative numbers, Bob Proulx, 2011/08/05
- Re: bug: return doesn't accept negative numbers, Linda Walsh, 2011/08/07
- Re: bug: return doesn't accept negative numbers, Bob Proulx, 2011/08/07
- Re: bug: return doesn't accept negative numbers, Linda Walsh, 2011/08/08
- Re: bug: return doesn't accept negative numbers, Jon Seymour, 2011/08/11
- Re: bug: return doesn't accept negative numbers, Chet Ramey, 2011/08/07
- Re: bug: return doesn't accept negative numbers, Eric Blake, 2011/08/08
- Re: bug: return doesn't accept negative numbers, Linda Walsh, 2011/08/08
- Re: bug: return doesn't accept negative numbers, Chet Ramey, 2011/08/08
- Re: bug: return doesn't accept negative numbers, Mike Frysinger, 2011/08/08