delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/07/08/08:01:47

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Dave Korn" <dk AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: negative error status: gcc vs. cl
Date: Thu, 8 Jul 2004 13:00:19 +0100
MIME-Version: 1.0
In-Reply-To: <20040708100919.GB32001@cygbert.vinschen.de>
Message-ID: <NUTMEGb9pPFR6sKBEr800000773@NUTMEG.CAM.ARTIMI.COM>
X-OriginalArrivalTime: 08 Jul 2004 12:00:19.0109 (UTC) FILETIME=[239D6D50:01C464E3]

> -----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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019