Etienne Gagnon writes:
 > Andrew Haley wrote:
 > > malloc() returns a char*, not a jbyte*.
 > 
 > So, can you tell me the difference between a jbyte and a "signed char"?
 > 
 > > Sigh.  No it isn't, and this code will break with gcc.
 > 
 > OK, maybe I am tired and I don't see it.  GCC -Wall does not complain
 > about the attached example.

When you have aliasing errors, the result is usually incorrect code,
not compile time warnings.

 > > ...  Also, "when a pointer to an object is converted
 > > to a pointer to a character type, the result points to the lowest
 > > addressed byte of the object.  Successive increments of the result, up
 > > to the size of the object, yield pointers to the remaining bytes of
 > > the object."
 > 
 > We agree on this.  Now: what's different between "signed char" and "jbyte"?
 > Can they actually be distinct on some platform?

Sure.  That's the question, really: whether on all platforms a jbyte
is necessarily a character type.  It isn't descibed as one on the JNI
spec, so it may or may not be.  On existing platforms it probably is,
but on those platforms a pointer will always fit into a long.

It all depends on how jbyte is defined: it can either be a signed
character type or not.  I'm suggesting that we should not depend on
that.

Andrew.


_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to