octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exit value


From: Jordi Gutiérrez Hermoso
Subject: Re: exit value
Date: Mon, 15 Jul 2013 17:11:37 -0400

On 15 July 2013 15:35, Stephen Montgomery-Smith <address@hidden> wrote:
> On 07/15/2013 11:51 AM, Vytautas Jancauskas wrote:
>> On Mon, Jul 15, 2013 at 7:44 PM, c. <address@hidden> wrote:

>> Exit values are interpreted as unsigned integers by the shell. The
>> following code will print 79 as well.
>>
>> int main()
>> {
>>   unsigned char x;
>>   x = -177;
>>   printf("%d\n", x);
>> }
>>
>>
>
>
> Yes, but shouldn't -1 print as 255?

No, it's a bit complicated. The exit code is actually 16 bits, but
usually stored in 32 bit integers, but you're usually interested in 8
bits for the exit code and 8 more bits for the signal (SIGSEGV or
SIGKILL or whatever).

   
http://stackoverflow.com/questions/2726447/why-is-the-exit-code-255-instead-of-1-in-perl

At any rate, there's no bug in Octave here. Perhaps in the complexity
of the POSIX standard regarding exit codes.

- Jordi G. H.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]