Back in the good old days I spent far more time writing C++ code than other things (well, there was no C# back then!). In those days, the initial support for 64-bit compilation was added to the Platform SDK (now the Windows SDK… again!).

At that time I couldn’t even dream of getting access to a 64-bit machine, and only very recently was able to get one. However, I still thought that learning to write portable 32/64-bit code the way the SDK prescribed was a good idea and so got used to it a bit.

It wasn’t actually all that hard. A big chunk of it was just being careful about integral/pointer conversions, using the new SDK data types like INT_PTR, ULONG_PTR and friends, and being wary of memory alignment issues. Just that would take you a long way on the right path. It was particularly easy when you were starting from scratch.

Since I do a lot less C++ these days, I had put a lot of that knowledge in the back of my head. Recently, however, I started looking into making some initial changes to an existing C++ code base to start cleaning up stuff for porting to 64-bits.

On the plus side, the Visual C++ compiler gives you a lot of really good warnings on problematic spots, either by actually compiling with the 64-bit compiler or by using the old /Wp64 switch on the regular 32-bit one (though the switch is deprecated now). Documentation on the Windows SDK about 64-bit porting issues is also fairly good.

On the negative side, it can still be a bit of a drag; it’s a lot more challenging to modify an existing, complex code base than starting writing portable code from scratch. Still, it’s been an interesting experience ;-).


Tomas Restrepo

Software developer located in Colombia.