views:

40

answers:

2

I was looking at some same code (a sample MS Visual Studio C++ project) recently with multiple build configurations (Release/Debug, Win32/x64).

My question: What is the difference? I guess I understand Release/Debug (Release = finalized version of project, Debug = version used to run in debugger), but what things need to be considered when building different versions for Win32/x64 platforms? Is there any coding differences, or does this just affect how that same code is ultimately built into machine code?

I know there are different library files depending on whether you're using a 32-bit or 64-bit system as well... Are all of these differences again just machine code? Would a 32-bit library file and its corresponding 64-bit library file be two files with exactly the same functions build from the same source code originally, and only differing in their machine code implementation?

Thanks!

--Russel

A: 

x32 runs a smaller footprint. "Words" are smaller (32bit vs 64bit). Generally, x64 bit operating systems are fantastic as they let apps use more than four gigabytes of RAM. However, unless you are using massive software like a database, 32x generally runs faster and more efficiently, especially on x64 bit operating systems.

Dr. Zim
Often, a 32-bit system can't utilize even 4 GiB of RAM, due to things like a 512 MiB graphics card mapping itself on top of the RAM. There are ways to work around this, even on 32 bit systems, but Windows, unless you pay up for the really nice version, doesn't support it.
Thanatos
A: 

There can be differences in how the code is written, but with a bit of care most code is pretty easy to write so it compiles and runs fine as either a 32-bit or 64-bit executable. Most of the problems arise when/if you do things like assuming similarity between Windows types (e.g., that a DWORD will hold a pointer -- true in 32-bit code but not in 64-bit code).

Also note that the last few iterations of the 32-bit compiler have had a warning you could enable for code that wouldn't port to 64-bit execution (and it seems pretty effective and accurate).

Jerry Coffin