Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > PORTING Applications from 32 bit to 64 bit Architecture

Reply
Thread Tools

PORTING Applications from 32 bit to 64 bit Architecture

 
 
Pallav singh
Guest
Posts: n/a
 
      04-01-2009
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
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      04-01-2009
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
 
Reply With Quote
 
 
 
 
SG
Guest
Posts: n/a
 
      04-01-2009
On 1 Apr., 15:30, Victor Bazarov <(E-Mail Removed)> 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
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      04-01-2009
On Wed, 1 Apr 2009 04:53:29 -0700 (PDT), Pallav singh <(E-Mail Removed)> 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!
 
Reply With Quote
 
SaticCaster
Guest
Posts: n/a
 
      04-02-2009
20 issues of porting C++ code on the 64-bit platform
http://www.viva64.com/art-1-2-599168895.html

The forgotten problems of 64-bit programs development
http://www.viva64.com/art-1-2-16511733.html

64 bits, Wp64, Visual Studio 2008, Viva64 and all the rest...
http://www.viva64.com/art-1-2-621693540.html

Optimization of 64-bit programs
http://www.viva64.com/art-1-2-1756520624.html

AMD64 (EM64T) architecture
http://www.viva64.com/art-1-2-1496710594.html
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      04-03-2009
On Wed, 01 Apr 2009 15:17:14 -0500, Paavo Helde <(E-Mail Removed)> wrote:
> Pallav singh <(E-Mail Removed)> 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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
porting application from 32 bit to 64 bit architecture Pallav singh C++ 0 04-01-2009 11:50 AM
syntax error near unexpected token `<bigaf>' - AIX C++ Application Porting from 32 bit to 64 bit r.nikhilk@gmail.com C++ 5 12-01-2005 08:03 PM
Porting C++ application on 32 bit to 64 bit on AIX - ld : 0711-317 ERROR : Undefined symbol r.nikhilk@gmail.com C++ 4 11-17-2005 02:03 AM
Porting VB 6 Applications from 32 Bit to 64 Bit =?Utf-8?B?cm9oaXQ=?= Windows 64bit 2 11-10-2005 02:33 PM
how can I use a signal defined in one Architecture to another Architecture Muhammad Khan VHDL 4 07-10-2003 06:14 PM



Advertisments