At first, I thought the prototype for calculator functions, such as iadd,
isub, imul, idiv, irem, jadd, jsub, jmul, jdiv, jrem, etc., might look
something like this:

jint iadd( jint a, jint b );

But this prototype does not allow for math errors. I am leaning toward a
prototype that's more like this:

short iadd( jint a, jint b, jint *result );

where a calculated result is returned through a parameter and the literal
return value of the function is an error code. The error code could be
mapped like the errno in the standard C library, where zero is for success
and non-zero is for failure. The calculator knows nothing of a virtual
machine, so it cannot "throw" an exception object.

When it uses the calculator library, the virtual machine can throw an
appropriate exception.



_______________________________________________
Kernel maillist  -  [EMAIL PROTECTED]
http://jos.org/mailman/listinfo/kernel

Reply via email to