Okay, but ANS specifically does not allow you to do this subtraction. Also, there is no guarantee that every pointer is representable as a ptrdiff_t. (6.5.6 Para 9, if you're interested)
The point is: if your platform is one that does *not* have 8-bit chars (!!!), then you can simply rewrite the appropriate code to put some bit representation of your pointer into a jbyte array (using whatever trick you need), and the only place where you would have to do it is the the wrap/unwarp functions. No modification on the Java side.
MORE IMPORTANTLY: As long as your platform has 8-bit chars/bytes (99,9%), [and that no crasy person decided that on such platform jbyte would be different from signed char!!!!], then my proposed code will just work out-of-the-box, and be quite efficient (for JNI code).
Comment: Now that you raised 6.5.6 para 9: how do you intend to cast such pointer to a jlong, in your proposal? [ironic]
OK. Let's stop splitting hairs in half. I have showed you a valuable and practical proposal. I'd like to see your full proposal, JNI part included.
Etienne
-- Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/
_______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath