Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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" To: Subject: RE: negative error status: gcc vs. cl Date: Thu, 8 Jul 2004 13:00:19 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit In-Reply-To: <20040708100919.GB32001@cygbert.vinschen.de> Message-ID: 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/