#12 64Bit errors (i think)

closed
nobody
None
5
2007-05-11
2007-03-09
Anonymous
No

When trying to compile cgkit on a 64bit platform i get the next errors:

include/slot.h: In member function 'void support3d::Slot<T>::removeDependent(support3d::Dependent*) [with T = double]':
include/slot.h:614: instantiated from 'support3d::Slot<T>::~Slot() [with T = double]'
src/planegeom.cpp:61: instantiated from here
include/slot.h:796: error: cast from 'support3d::Dependent*' to 'int' loses precision
include/slot.h: In member function 'void support3d::Slot<T>::removeDependent(support3d::Dependent*) [with T = int]':
include/slot.h:614: instantiated from 'support3d::Slot<T>::~Slot() [with T = int]'
src/planegeom.cpp:61: instantiated from here
include/slot.h:796: error: cast from 'support3d::Dependent*' to 'int' loses precision
include/slot.h: In member function 'void support3d::Slot<T>::addDependent(support3d::Dependent*) [with T = int]':
src/planegeom.cpp:214: instantiated from here
include/slot.h:783: error: cast from 'support3d::Dependent*' to 'int' loses precision
include/slot.h: In member function 'void support3d::Slot<T>::setController(support3d::ISlot*) [with T = int]':
src/planegeom.cpp:214: instantiated from here
include/slot.h:732: error: cast from 'support3d::ISlot*' to 'unsigned int' loses precision
include/slot.h:741: error: cast from 'support3d::ISlot*' to 'unsigned int' loses precision
include/slot.h:777: error: cast from 'support3d::ISlot*' to 'unsigned int' loses precision
include/slot.h: In member function 'void support3d::Slot<T>::addDependent(support3d::Dependent*) [with T = double]':
src/planegeom.cpp:214: instantiated from here
include/slot.h:783: error: cast from 'support3d::Dependent*' to 'int' loses precision
include/slot.h: In member function 'void support3d::Slot<T>::setController(support3d::ISlot*) [with T = double]':
src/planegeom.cpp:214: instantiated from here
include/slot.h:732: error: cast from 'support3d::ISlot*' to 'unsigned int' loses precision
include/slot.h:741: error: cast from 'support3d::ISlot*' to 'unsigned int' loses precision
include/slot.h:777: error: cast from 'support3d::ISlot*' to 'unsigned int' loses precision

Version: cgkit-2.0.0_alpha7
Possible cause: On 64bit plafroms a pointer is 64bit and nolonger 32bits. Since an in on 64bit's is also 32 bit wide ... This results in havoc... You can't cast a 64bit pointer to a 32bit int ...
Possible solution: Use pointers ... when using pointers ... (replace int with (*void))

Discussion

  • Logged In: NO

    When looking into these (and solving them) ... it are simple debug messages ... Consider removing those / changing them to 64bit compatible code...

     
  • Matthias Baas
    Matthias Baas
    2007-03-10

    Logged In: YES
    user_id=211477
    Originator: NO

    The problem has been mentioned before (see http://sourceforge.net/forum/forum.php?thread_id=1590475&forum_id=166517 for a workaround).
    I'd like to fix it but I don't know what the proper way is to print a pointer on a 64Bit machine. I'd be grateful for any suggestions.

    - Matthias -

     
  • Matthias Baas
    Matthias Baas
    2007-05-11

    Logged In: YES
    user_id=211477
    Originator: NO

    The pointer is now printed using %p (%#lx might be another alternative).

     
  • Matthias Baas
    Matthias Baas
    2007-05-11

    • status: open --> closed