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: Thu, 8 Apr 2004 13:46:09 +0100

Etienne Gagnon writes:
 > 
 > Now that my proposal has been criticised to death on the smallest
 > nitpicks of pure ISO C portability, let me comment on the portability
 > ]of your code.
 > 
 > 
 > The ISO C standard says:
 > 
 >         [#6]  Any  pointer type may be converted to an integer type;
 >         the result is implementation-defined.  If the result  cannot
 >         be   represented  in  the  integer  type,  the  behavior  is
 >         undefined.  The result need not be in the range of values of |
 >         any integer type.
 > 
 > So, the conversion of "p" to "jlong" or "jint" yields a *compiler-specific*
 > value; ISO C does not guarantees anything about the actual value resulting
 > from the cast.  In other words, a compiler would be allowed to change
 > the bits of the pointer value when converting.

Exactly: the only reliable way I can see to do this is to use memcpy()
from the big pointer to a byte array.  But, compared to the overhead
of a JNI call, that is no big deal.

Andrew.




reply via email to

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