-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Johannes Hofmann wrote:
object.cc:118: error: cast from ?void*? to ?int? loses precision
I felt it was nonsense to check the size of void* at runtime and used the preprocessor to choose which instruction to use based on the value of SIZEOF_VOID_P.
I think the idea is that the compiler will optimize out unnecessary branches. And indeed the assembly code looks like this here:
Ah, I see. But surely I can't be the only one having problems with this code? $ gcc -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v - --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr - --enable-shared --with-system-zlib --libexecdir=/usr/lib - --without-included-gettext --enable-threads=posix --enable-nls - --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 - --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc - --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu - --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7) $ uname -a Linux thinkbox 2.6.24-15-generic #1 SMP Mon Apr 7 16:37:53 UTC 2008 x86_64 GNU/Linux And I would guess my compiler bails out at parsing the code and building an syntax tree way before it has a chance to optimize out any branches. Maybe your compiler is more permissive, either because it's a different version or you're on a different architecture where sizeof(int) == sizeof(void*) so there isn't any "loss of precision"? Justus - -- gpg key fingerprint: C82D 382A AB38 1A54 5290 19D6 A0F9 B035 686C 6996 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIEZxCoPmwNWhsaZYRAhYmAJ4zATWlJpwFzwLlI0I3joMtmY1AOgCgmSWg /j07wxgS2ppgaV5swTCRubI= =MFTB -----END PGP SIGNATURE-----