Igor could be right about (status &= 0x), just in case is not masked by
_exit() as for msvcrt exit()
% cat err.c
#include
int main(int argc, char **argv)
{
if (argc == 1)
return (0);
exit(strtol(argv[1], NULL, 16));
}
- b31 = b16 = 0 -
% err-cl 0x7ffeff5a ; printf "%
> -wrong-nil(!)-exit-status-
> % nerr-cl.exe; echo $?
> 0
>
> $? cannot distinguish exit(0) from exit(-2) ... this is
> logical anarchy!
:) Ah, but those aren't just two different values passed to exit, they are
:) in fact two entirely different versions of the exit function: gcc links
:) "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, sta
> 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
I wouldn't do that. The problem is other did
Feel like bash tcsh on Cygwin mess up with negative exit status from a cl
compiled .exe
% uname -a
CYGWIN_NT-5.0 pc 1.3.22(0.78/3/2) 2003-03-18 09:20 i686 unknown unknown Cygwin
% echo $SHELL
/bin/bash
% cat nerr.c
int main()
{
exit (-2);
}
% gcc -o nerr-gcc nerr.c
% cl -o nerr-cl nerr.c
M
5 matches
Mail list logo