#2 Patch for bug #1677388, "64Bit errors"

closed
nobody
None
5
2007-05-11
2007-04-09
Paul Egan
No

Build was failing on x86_64 with "error: cast from 'support3d::Dependent*' to 'int' loses precision".

Replaced sprintf("0x%x",(int)ptr) calls with
sprintf("%p",(void*)ptr).

Tested patch on x86_64 & i686 Linux (FC6).

Discussion

  • Matthias Baas

    Matthias Baas - 2007-05-11
    • status: open --> closed
     
  • Matthias Baas

    Matthias Baas - 2007-05-11

    Logged In: YES
    user_id=211477
    Originator: NO

    I have just changed and committed the new format strings.
    By the way, just recently I saw a note somewhere which discouraged using %p as they said it behaves differently on Windows and Linux...? I've just tested on Windows and OSX and everything was fine here (however, it was not 64Bit Windows). They were recommending to use %#LX. I thought I rather mention that here so that it is archived and I can look it up when someone complains again... ;)

     
  • Paul Egan

    Paul Egan - 2007-05-11

    Logged In: YES
    user_id=1763673
    Originator: YES

    Note that when using %p, a non-zero result has the string '0x' prepended
    to it, yet the new committed format strings include a redundant '0x'.
    The same applies for %#LX.

     
  • Matthias Baas

    Matthias Baas - 2007-05-11

    Logged In: YES
    user_id=211477
    Originator: NO

    Looks like now we know what the differing behavior of %p under Windows and Linux is. On Windows, %p did not output a leading "0x" whereas %#lx does. So I've switched to the latter now and removed the 0x in the strings.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks