Pete Buelow wrote:
> I'm trying to build FlightGear for FC4 on an nifty new amd64 game
> machine. I used to fly on a slightly slower Athlon, but want to
> step up to the plate and see if things are that much better with
> my new video card and 64 bit processor. Here's the issue.
>
> [... a spot where a pointer is cast to an int ...]

Yes, gcc 4.0 will not allow you to directly cast a pointer to an
integer on systems where their sizes differ, due to the
information loss problem (which is real in this case, as the
value is used as an "ID").  I think I posted this a while back,
but maybe I just remember thinking about doing it.

On my build, I just hacked the casts (I think there are two,
actually) to be of the form:

   (int)(long)pointerValue

This "double cast" construction compiles and works.  At least on
my system, you can verify using pmap that there is no heap memory
mapped to addresses that are equal "modulo 2^32", so there is no
possibility of collision.  It really isn't an appropriate
permanent solution, though.  The ID values should be guaranteed
to be unique on all platforms.

Andy


_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to