regd 32-bit and 64 bit programming models


 
Thread Tools Search this Thread
Operating Systems AIX regd 32-bit and 64 bit programming models
# 1  
Old 05-19-2006
regd 32-bit and 64 bit programming models

i read that an application can remain as a 32-bit applicarion and still run on a 64-bit operating system without any code changes.

But some documents also suggest that during porting 32 bit applications need to have code changes especially pointers and int and long and that they should be replaced with derived data types so that it enables them to compile on both 32-bit and 64-bit mode.

can i have more clarifications on this as this seems to be contradicting and confusing?
# 2  
Old 05-19-2006
This will be far from a complete answer as there are many subtleties but I can at least cite my own experiences which may not be true for all compilers and architectures. That said, in a nutshell...

In most 32-bit environments, the data type int and all pointers were 4-bytes. On some systems, a long was also 4-bytes with a long long being 8-bytes. In most 64-bit environments, the int remains 4-bytes, the long is 8-bytes (as is the long long defined only for backward compatibility), and the pointer data type increased to 8-bytes.

Problems arise in code that ASSUME the size of each data type specifically that an int and a pointer are exactly the same length. As stated, in 32-bit environments, that is a safe bet however when moving to 64-bit compilers that is not necessarily true. As a result, programs that rely on a specific size of, say, a structure containing integers used as pointers are now in error as they have different memory allocations.

Compilers come with derived data types to be used when working with pointers and integers of varying size but most people -- myself included -- use the standard C datatypes. Those work fine, of course, but require extra caution especially if working with unions, bit-mapped data types, implicit datatype conversion, and such. Often inconsistencies can be overcome with explicit casting.

I hope my explanation has helped.

Last edited by hegemaro; 05-19-2006 at 12:52 PM..
# 3  
Old 03-04-2008
Hi...

I have to move my 32 bit application code on 64 bit AIX environment. Will I have to make changes in code for the datatypes? Please suggest.

Thanks.
Megha
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Which version of Windows Vista to install with a product key? 32-bit or 64-bit?

Hello everyone. I bought a dell laptop (XPS M1330) online which came without a hard drive. There is a Windows Vista Ultimate OEMAct sticker with product key at the bottom case. I checked dell website (here) for this model and it says this model supports both 32 and 64-bit version of Windows... (4 Replies)
Discussion started by: milhan
4 Replies

2. Shell Programming and Scripting

How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H

Hi, Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result. perl interpreter info, perl, v5.8.8 built for... (0 Replies)
Discussion started by: rrd1986
0 Replies

3. UNIX for Advanced & Expert Users

migrating unix mp-ras 32 bit to linux suse 64 bit

Hi. I need to migrate the whole unix environment from a Unix mp-ras 32 bit to a Linux Suse 64 bit. 1) can i use cpio to copy the data? 2) can i just copy the users from unix to linux or do i have to create them by hand 3) are there any other concerns i should worry about? thanx (1 Reply)
Discussion started by: mrodrig
1 Replies

4. Programming

copying or concatinating string from 1st bit, leaving 0th bit

Hello, If i have 2 strings str1 and str2, i would like to copy/concatenate str2 to str1, from 1st bit leaving the 0th bit. How do i do it? (2 Replies)
Discussion started by: jazz
2 Replies
Login or Register to Ask a Question