#47 Replace __int64 with long long for compatibility

closed-rejected
nobody
None
3
2006-10-23
2006-09-17
Kimmo Varis
No

We've used __int64 as 64-bit type. But it is MS
expansion to Visual C so it is not portable.

long long is C99 standard's (at least) 64-bit -type.

Discussion

  • Kimmo Varis

    Kimmo Varis - 2006-09-23
    • priority: 5 --> 3
     
  • Kimmo Varis

    Kimmo Varis - 2006-09-23

    Logged In: YES
    user_id=631874

    It appears VC6 doesn't recognize long long type.

    Duh.

    So maybe we should use our own typedef for 64-bit ints to
    keep them compiling with VC6 and also make code more
    portable. I'm specifically thinking about backend compare
    code we want to use with APR...

     
  • elsapo

    elsapo - 2006-09-26

    Logged In: YES
    user_id=1195173

    Here is an example of code I'm using where I'm interfacing
    with berkeleydb code (the ifdef is from their header, I
    didn't invent it) -- this is from a windows-only subsection
    of a header file. The unix version gets these typedefs from
    <sys/types.h> I think.

    -----------

    #ifndef __BIT_TYPES_DEFINED__
    #define __BIT_TYPES_DEFINED__
    typedef unsigned __int8 u_int8_t;
    typedef signed __int16 int16_t;
    typedef unsigned __int16 u_int16_t;
    typedef signed __int32 int32_t;
    typedef unsigned __int32 u_int32_t;
    typedef signed __int64 int64_t;
    typedef unsigned __int64 u_int64_t;
    #endif

     
  • Kimmo Varis

    Kimmo Varis - 2006-09-26

    Logged In: YES
    user_id=631874

    Problem with $product specific typedefs is that every
    product uses their different notation. :( There are uint64,
    u_int64, _uint64 etc etc. Which gets nasty when you try to
    use two such libraries...

    Anyway it seems very likely we start building compare code
    with APR library so that part of code can easily use APR
    typedefs.

     
  • elsapo

    elsapo - 2006-09-26

    Logged In: YES
    user_id=1195173

    That is why there are typedefs in the code I quoted, to
    avoid all that ugliness. See, those are typedefs, and only
    occur once -- then all other code is built on top of the
    typedefs, and doesn't need to know about them.

    (I think this is a really common solution to cross-platform
    use.)

    There are a lot of such typedefs, mostly to work around poor
    Microsoft support for standards. But what is being
    consolidated via those typedefs is not different typedefs in
    different libraries, but rather different base types in
    different compilers (what I think you call "products").

    Practically, in that project, one can simplify greatly and
    say that there is gcc, used by a zillion platforms,
    including mingw and cygwin, and there is Visual Studio's
    special workarounds.

     
  • Kimmo Varis

    Kimmo Varis - 2006-09-26

    Logged In: YES
    user_id=631874

    Sorry, I didn't really explain my point. What I was saying
    is different code usually has different typedefs. And
    sometimes getting them work with each other isn't easy. Or
    is just ugly.

    Well, I think we need to just adobt some typedefs and start
    using them. And APR would be a good choice since it is
    already cross-platform and used in lots of different
    environments so we know it works. :)

    [BTW, I yesterday added some more info about PSDKs, VC/VS
    versions and setting them for compiling WinMerge into
    docs/developers/readme-developers.html. Maybe that helps you
    too, as I remember you had problems in compiling. Though you
    didn't tell what kind of problems..]

     
  • elsapo

    elsapo - 2006-09-28

    Logged In: YES
    user_id=1195173

    I didn't say why I couldn't compile because it was the same
    reason as so many times before and I guessed you would not
    want to hear it again; because I don't have the platform sdk
    available to me everywhere.

     
  • Kimmo Varis

    Kimmo Varis - 2006-10-23
    • status: open --> closed-rejected
     
  • Kimmo Varis

    Kimmo Varis - 2006-10-23

    Logged In: YES
    user_id=631874

    Closing as this cannot be implemented as originally planned.
    VC6 does not support long long type and we want to support VC6.

     

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