PORTING Applications from 32 bit to 64 bit Architecture

Discussion in 'C++' started by Pallav singh, Apr 1, 2009.

  1. Pallav singh

    Pallav singh Guest

    Hi

    are these only the changes we need to do while porting application
    from 32 bit architecture to 64 bit architecture ??

    In 64 bit architecture, Address is 64 bit but integer is still 32 bit

    Architecture Dependencies (64 bit vs 32 bit)
    • Data Types and Sizes
    • Pointers
    Type casts, setting to 0, comparison, pointer arithmetic
    • Data Alignment and Padding
    Member Alignment, Structure Alignment
    • Bit Shifts
    Result Type
    • Constants
    Constant values may have differ(related to size issue)
    • Library Calls and Operators
    printf, scanf, malloc, calloc, sizeof, memcpy etc

    Endianism (Little Endian vs Big Endian)
    • Byte Ordering
    • Initializing Multiword Entities
    • Unused Bytes
    Bit masks etc
    • Hex Constants Used as Byte Arrays
    • Data Transfer Between LE and BE Systems

    Other OS Dependencies
    • Interprocess Communication (Blocking vs Non Blocking calls)
    • Timers
    • Signals
    Reliable and unreliable
    • Communication Stacks, subsystems
    • Language Extensions
    Ex: Librairies like X11, ACE etc
    • Memory mapped files, asynchronous I/O, performance
    constraints etc

    Tools and Utilities
    • Build Environment
    Compiler flags, #pragma definitions, default options etc
    • Object Formats (Most systems use ELF)

    Thanks
    Pallav Singh
     
    Pallav singh, Apr 1, 2009
    #1
    1. Advertising

  2. Pallav singh wrote:
    > Hi


    What's wrong? You post an almost identical article three minutes (!)
    apart. Are you impatient to get a reply? Well, this isn't a chat room.
    Are you experiencing problems? Contact your ISP. Please refrain from
    polluting the cyberspace.

    > are these only the changes we need to do while porting application
    > from 32 bit architecture to 64 bit architecture ??
    >
    > In 64 bit architecture, Address is 64 bit but integer is still 32 bit


    No, not necessarily. Besides, there are different integers in C++, some
    are 32 bit, some are 16 bit, and some even 8 bit (signed char, for
    example). It is all platform-specific.

    > [.. long list of "only" changes ..]


    I strongly recommend that you ask your platform-specific question in the
    newsgroup dedicated to your platform.

    Generally speaking, your program needs to be written in such a way that
    it does not depend on the *size* of the data it operates, or the
    endianness of the storage. Then you have no problems shifting from one
    environment to the next.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Apr 1, 2009
    #2
    1. Advertising

  3. Pallav singh

    SG Guest

    On 1 Apr., 15:30, Victor Bazarov <> wrote:
    > Generally speaking, your program needs to be written in such a way that
    > it does not depend on the *size* of the data it operates, or the
    > endianness of the storage.  Then you have no problems shifting from one
    > environment to the next.


    Or even shorter:

    non-portable <=> dependence on implementation-defined behaviour

    I think that catches it. Of course, the trick is then to know what
    part of C++ is implementation-defined.


    Cheers!
    SG
     
    SG, Apr 1, 2009
    #3
  4. Pallav singh

    Jorgen Grahn Guest

    On Wed, 1 Apr 2009 04:53:29 -0700 (PDT), Pallav singh <> wrote:
    > Hi
    >
    > are these only the changes we need to do while porting application
    > from 32 bit architecture to 64 bit architecture ??


    They are not changes, but areas where it might matter.
    I cannot tell if it is complete.

    > In 64 bit architecture, Address is 64 bit but integer is still 32 bit


    Likely, but not necessarily true. "64-bit" is not very well defined.

    [snip list of areas]

    The only problem I've encountered when porting to Linux on AMD64 was
    braindead code which relied on struct memory layout.

    Another change is increased memory usage for pointer-intensive data
    structures. (Can't remember if you listed it.)

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
    \X/ snipabacken.se> R'lyeh wgah'nagl fhtagn!
     
    Jorgen Grahn, Apr 1, 2009
    #4
  5. Pallav singh

    SaticCaster Guest

    SaticCaster, Apr 2, 2009
    #5
  6. Pallav singh

    Jorgen Grahn Guest

    On Wed, 01 Apr 2009 15:17:14 -0500, Paavo Helde <> wrote:
    > Pallav singh <> kirjutas:
    >
    >> Hi
    >>
    >> are these only the changes we need to do while porting application
    >> from 32 bit architecture to 64 bit architecture ??

    ....

    > For porting my code to 64-bit the main problem was that the result of
    > std::string::find() and friends was often stored in an unsigned int, which
    > made it impossible to compare with std::string::npos. Fortunately enough,
    > g++ spits out good warnings about this.


    Come to think of it, that's probably the best advice: turn on every
    compiler warning you can find[1], and review all places where the code
    discards type information (casts and so on).

    Doing this with just "g++ -c foo.cc" is doing it blindfolded.

    /Jorgen

    [1] In the g++ case, at least -W, -Wall, -pedantic and -std=.

    --
    // Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
    \X/ snipabacken.se> R'lyeh wgah'nagl fhtagn!
     
    Jorgen Grahn, Apr 3, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page