14 October 2007

C++ and 64-bits

When pursuing the development of a 64-bit native program you realise that everything is not what you thought it was. Somehow I had convinced myself of the wrong sizes for the built in types. This wasn't due to ignorance but due to the plethora of 64-bit implementations.

I'd somehow convinced myself the data model I was programming to was ILP64, but for Windows as it turns out uses LLP64. Normally you don't discover it until you get to the point your program collapses in a heap under heavy load.

Here are some relevant articles here, here, here, and here. The good thing is if you statically check your code with something like Lint pretty strictly a lot of the problems you would normally encounter don't exist.

For the data models have a look at this article. For some reason the table won't display correctly in my blog.