Sign in to follow this  
The C modest god

Programming for 64bit OS/PC

Recommended Posts

What differences are there for programming on 64bit OS rather then 32bit OS? Does the windows API for 64 bit is different then the 32 bit? The size of int is different? A program written for 64 bit cant run on a 32bit OS/PC? Thanks in advance.

Share this post


Link to post
Share on other sites
cenix    122
Quote:
Original post by The C modest god
What differences are there for programming on 64bit OS rather then 32bit OS?

For the programmer, not too much, you only need to take care of some types.

Quote:
Does the windows API for 64 bit is different then the 32 bit?

Yes, 64 bit types are larger than 32 bits, but some remain the same. Do a search on MSDN or Google for the exact width. The API has special types and functions to help you.

Quote:
A program written for 64 bit cant run on a 32bit OS/PC?

No, because 32-bits cannot handle 64 bit types.
I somehow also don't believe it is possible to run 32-bit apps on 64 bit CPU's either (can someone verify this), but there are some 'emulators' like WoW (Windows on Windows) which allow you to use 32-bit applications on a 64-bit OS.

Overall advice, do a search on Google or MSDN to find out more.
(Hint: www.devx.com and AMD have also some good documents)

Share this post


Link to post
Share on other sites
Sharlin    864
Well, AMD64 has a complete IA-32 emulation layer built-in and running at native speeds. For any 32-bit software, it looks and feels like a 32-bit processor. I'd say that a very large majority of AMD64 owners only run a 32-bit OS on it, at this point.

Also, AFAIK, at least 64-bit Linux has no problem running 32-bit applications provided that the processor can handle them. You do need a 32-bit userland, though (libraries and stuff), in addition to the 64-bit one.

Share this post


Link to post
Share on other sites
_goat    804
I'm fairly certain it's the same for the 600 line of Intel processors - they can emulate at native speeds 32 bit.

Somone please correct me if I'm wrong - I don't think I am.

Share this post


Link to post
Share on other sites
Degski    178
Things aren't that different as thery might look. All types are virtually the same (from the programmers persective), so that's not much of a problem, int is still 32bit etc.

Pointers though are now all 64-bit. Pointer-Pointer arithmatic is no problem, mixing pointers and other types might (will) generate conversion warnings, which might, or might not be harmless, depends on the code. Also shifts might be implicitely converted from 32-bit shifts to 64-bit shifts, these need to be checked as well!

Another thing, you cannot mix 32-bit and 64-bit program-components, so if you call a function in a DLL from a 64-bit program, it needs to be 64-bit as well.

With this precursor, all 32-bit software will run perfectly well, and it's said in certain cases even better than on a 32-bit XP. The AMD64 architecture ensures that no penalty is incurred running 32-bit soft on 64-bit OS, there's no emulation of 32-bits, the processor runs 32-bit code, it just needs to be told by the OS that this particular code is 32-bit and that it should run it as such!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this