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: Andrew Haley
Subject: RE: Classpath build process and VM-specific issues
Date: Tue, 6 Apr 2004 10:19:41 +0100

David Holmes writes:
 > 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.

True, yes.

 > 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.

No, because of aliasing rules.  You can't convert a pointer between
two types that are not character types and then dereference it.

Andrew.




reply via email to

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