Matthias Boerner wrote:
> I tried to compile a new CVS snapshot of FlightGear. I got following
> error message:
> AIBase.cxx: In member function ‘int FGAIBase::_getID() const’:
> AIBase.cxx:401: error: cast from ‘const FGAIBase*’ to ‘int’ loses precision
This is a known bug when compiling on a 64 bit system. I fix it in my
tree by double casting:
--- AIBase.cxx 5 Sep 2005 13:25:09 -0000 1.41
+++ AIBase.cxx 10 Oct 2005 23:39:47 -0000
@@ -398,7 +398,7 @@
}
int FGAIBase::_getID() const {
- return (int)(this);
+ return (int)(long)this;
}
This fix can't be checked in though, because it isn't correct*. The
generated ID is not guaranteed to be unique. The right solution would
be to either change the type of the ID to a "long long" or "uint64_t",
or generate an identifier from something other than the pointer value.
* It will also fail in Win64, where sizeof(long)==4
> {standard input}: Assembler messages:
> {standard input}:446: Error: Local symbol `.LTHUNK0' can't be equated to
> undefined symbol `_ZN9logstreamD1Ev'
> {standard input}:446: Error: Local symbol `.LTHUNK1' can't be equated to
> undefined symbol `_ZN9logstreamD0Ev'
These I don't recognize. Assembler errors are very rare. It's
possible that they're a side effect of the warning above, and a
misfeature/interaction between the assembler and gcc 4.0.2 (which is
quite new).
Andy
_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d