Please do not cast between 32 bit integers and
pointers, this breaks on any Unix 64 bit platform
(including my AMD64 :)
Except for very special low level algorithms such as
garbage collectors, and, when interfacing to broken
APIs, converting between integers and pointers is never
required.
If you REALLY need to do this:
One way to do this is to use ISO C99 data types
intptr_t and uintptr_t from <stdint.h> provided this
header is available and those types are defined (which
requires a configuration time check to determine). You
can use this test to determine if the type is defined,
given the header is available:
#ifdef INTPTR_MIN
// intptr_t is available
The other way is to measure the size of a pointer and
integers and pick one the right size.
Note there is NO portable way to do this: configuration
checks are mandatory.
As an example of the error:
terrainmesh.h:764: error: cast from ‘void*’ to ‘U32’
loses precision
HOWEVER I stronly recommend you re-exmaine you code,
since as noted, such casts are usually symptomatic of a
systematic design error. In particular, it is never
necessary to do this to perform address calculations,
the correct way is to cast to unsigned char pointer.
If you need access to a 64 bit platform please drop me
an email.
Logged In: YES
user_id=95308
I'm aware it doesn't compile on a 64 bit system, and I
understand why. I'll address the issue when I get a 64 bit
system to build and test on, or someone who will work with
me to fix it.