[M3devel] libm3/Process.ExitCode?

Jay K jay.krell at cornell.edu
Mon Feb 21 12:12:10 CET 2011


TYPE ExitCode = [0 .. 16_7FFFFFFF];


(* An exit code (or status) of zero normally means successful
   termination, and a non-zero value normally indicates an error, but
   the exact conventions vary between systems and programs. *)

Is there a good reason this isn't a full INTEGER?
Or at least a full Cstdint.int32_t?

In the Win32 case, we mask the actual exit code with this,
which will lead to the non-zero 0x80000000 becoming zero.

I'm inclined to change it like:

before:
RETURN Word.And(status, LAST(ExitCode))

after:
(* for some reason, cut off the high bit, but
 * if that turns non-zero into zero, then still return non-zero *)
maskedStatus := Word.And(status, LAST(ExitCode));
IF status <> 0 and maskedStatus = 0 THEN
  maskedStatus := 1;
END;
RETURN maskedStatus

Or change ExitCode to plain lossless INTEGER.
But maybe negative values were avoided for some reason?

I understand that on Posix, I think, you just get an 8 bit unsigned value.


 - Jay
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20110221/cba93873/attachment-0001.html>


More information about the M3devel mailing list