This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: negative error status: gcc vs. cl
- From: "Dave Korn" <dk at artimi dot com>
- To: <cygwin at cygwin dot com>
- Date: Thu, 8 Jul 2004 13:00:19 +0100
- Subject: RE: negative error status: gcc vs. cl
> -----Original Message-----
> From: cygwin-owner On Behalf Of Corinna Vinschen
> Sent: 08 July 2004 11:09
> On Jul 8 11:49, Daniel Lungu wrote:
> > Feel like bash tcsh on Cygwin mess up with negative exit
> status from a cl
> > compiled .exe
>
> The answer is "don't do that". Use positive values in the range from
> 0 to 255. See
> http://www.opengroup.org/onlinepubs/009695399/functions/exit.html
Well, according to that page, the answer is 'you may do that':
"The value of status may be 0, EXIT_SUCCESS, EXIT_FAILURE, [CX] or any
other value"
but what you shouldn't do is expect the exit status in the shell to be
anything other than the least-significant byte of the value you passed:
"though only the least significant 8 bits (that is, status & 0377) shall be
available to a waiting parent process."
So -2 comes back as 254. Sounds like perfectly correct 2's complement
arithmetic to me!
cheers,
DaveK
--
Can't think of a witty .sigline today....
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/