classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Classpath build process and VM-specific issues


From: David Holmes
Subject: RE: Classpath build process and VM-specific issues
Date: Tue, 6 Apr 2004 10:01:14 +1000

Well if we're being pedantic and imprecise to boot ...

> >> malloc() returns a char*, not a jbyte*.

malloc() returns void* not char*. It hasn't returned char* since pre ANSI C.
Hence the pointer returned by malloc can be legally converted to any real
pointer type with clearly defined semantics.

Taking the address of a void* and pretending that it is the address of a
jbyte* is not legal. However, it is legal to convert between an int and a
pointer type and a pointer type and an int. If the address represented by
the int is incorrectly aligned for the pointer type then the result is
undefined. Otherwise the result is implementation specific. Hence you can
write legal but (by definition) non-portable code to do what you want.

David Holmes





reply via email to

[Prev in Thread] Current Thread [Next in Thread]