in reply to return value from system call, exit status, shift right 8, bitwise and, $?

My understanding of the system function is that it returns a 16-bit value, where the high 8 bits are the exit status, and the low 8 are the signal id.
Can we really rely on this? I know that this is true for the Perl implementations I worked with, but I can't find anywhere in the docs that the exist status has to be 8 bit. This is certainly true for Unix-like systems. On Windows, programs can return 32 bit exitcode (although at least ActiveState Perl 5.8 and 5.10 throws away part of the bits). I could imagine that in later/different implementations, all 32 bits could be returned on Windows.

-- 
Ronald Fischer <ynnor@mm.st>
  • Comment on Re: return value from system call, exit status, shift right 8, bitwise and, $?
  • Download Code

Replies are listed 'Best First'.
Re^2: return value from system call, exit status, shift right 8, bitwise and, $?
by Khen1950fx (Canon) on Feb 11, 2010 at 12:13 UTC
      I didn't find anything in this section of perlfaq8 about the number of significant bits in the result of system, but I believe ikegami of course ;-)

      -- 
      Ronald Fischer <ynnor@mm.st>