Solved

32-bit build & 64-bit build/ C++

Posted on 2008-06-19
5
276 Views
Last Modified: 2013-12-09
Hello
I have seen many C/C++ applications which has seperate build code for 32-bit and 64-bit machine.

May i know, the genuine reason for coming up with different build code for different bit size?

Regards
Sham
0
Comment
Question by:sham_ibmgs
5 Comments
 

Author Comment

by:sham_ibmgs
ID: 21820470
I have seen a security application, which has different builds, i cannot name it

Regards
Sham
0
 
LVL 45

Accepted Solution

by:
Kdo earned 100 total points
ID: 21821541
Hi Sham,

There are several reasons, among them:

-  64 bit code takes advantage of the 64-bit instructions.  This is largely a compiler issue, but code sometimes migrates to look more native.

#ifdef (INT_IS_64_BITS)
  int     IntValue;
#else
  __int64   IntValue;
#endif

-  64 bit code takes advantage of the 64-bit APIs, especially system interface calls.

-  Some file handling is per-force different with 32 and 64 bit systems.  The ff_blk structure (used with many of the I/O functions) is a 32 or 64-bit structure depending on the O/S.  On a 32-bit O/S, direct access (seek) to a position in a file is limited to to first 2GB.  The code would have to utilize some strange looking techniques to perform I/O at locations higher than 2GB, while it would be transparent on a 64-bit O/S.


Kent
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PC will not stay shut down 56 123
Convert money to nchar 4 54
How to split this in C++ 4 94
Resolve Dependency Issues 4 45
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now