On Fri, Apr 25, 2008 at 04:38:09PM +0200, Johannes Hofmann wrote:
On Fri, Apr 25, 2008 at 10:54:26AM +0200, Justus Winter wrote:
-----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"?
You seem to be the first one to try to compile dillo2 with 64bit. So yes, we need to fix that compilation problem. It's just that currently there is hardly any conditional compilation in dw-testbed and it would be nice to keep it that way. Do you think you can fix the problem without any preprocessor conditionals? Perhaps with some sort of cast as in the callback case.
Yes, that's right. Doesn't dlib's VOIDP2INT() work in this case? -- Cheers Jorge.- PS: Sorry for the lack of presence lately. I've been fully busy.