octave-maintainers
[Top][All Lists]
Advanced

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

Re: exit value


From: Vytautas Jancauskas
Subject: Re: exit value
Date: Mon, 15 Jul 2013 19:51:34 +0300

On Mon, Jul 15, 2013 at 7:44 PM, c. <address@hidden> wrote:
> Hi,
>
> I'm not sure whether this is expected behaviour so I am asking before filing 
> a bug.
>
> The following work as I expect:
> $ octave-cli -q --norc --eval "exit (0)"; echo $?
> 0
> $ octave-cli -q --norc --eval "exit (1)"; echo $?
> 1
> $ octave-cli -q --norc --eval "exit (177)"; echo $?
> 177
>
> but the ones below look surprising:
>
> $ octave-cli -q --norc --eval "exit (-177)"; echo $?
> 79
> $ octave-cli -q --norc --eval "exit (-1)"; echo $?
> 0
>
> is this the way it is supposed to work?
>
> c.


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);
}


reply via email to

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