Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the big deal with BUILDING 64-bit versions of binaries?

There are a ton of drivers & famous applications that are not available in 64-bit. Adobe for instance does not provider a 64-bit Flash player plugin for Internet Explorer. And because of that, even though I am running 64-bit Vista, I have to run 32-bit IE. Microsoft Office, Visual Studio also don't ship in 64-bit AFAIK.

Now personally, I haven't had much problems building my applications in 64-bit. I just have to remember a few rules of thumb, e.g. always use SIZE_T instead of UINT32 for string lengths etc.

So my question is, what is preventing people from building for 64-bit?

like image 245
user15071 Avatar asked Oct 01 '08 22:10

user15071


2 Answers

If you are starting from scratch, 64-bit programming is not that hard. However, all the programs you mention are not new.

It's a whole lot easier to build a 64-bit application from scratch, rather than port it from an existing code base. There are many gotchas when porting, especially when you get into applications where some level of optimization has been done. Programmers use lots of little assumptions to gain speed, and these are not always easy to quickly port to 64-bit. A few examples I've had to deal with:

  • Proper alignment of elements within a struct. As data sizes change, assumptions that certain fields in a struct will be aligned on an optimal memory boundary may fail
  • Length of long integers change, so if you pass values over a socket to another program that may not be 64-bit, you need to refactor your code
  • Pointer lengths change, as so hard to decipher code written be a guru that has left the company become a little trickier to debug
  • Underlying libraries will also need to have 64-bit support to properly link. This is a large part of the problem of porting code if you rely on any libraries that are not open source
like image 99
jvasak Avatar answered Nov 15 '22 19:11

jvasak


In addition to the things in @jvasak's post, the major thing that can causes bugs:

  • pointers are larger than ints - a huge amount of code makes the assumption that the sizes are the same.

Remember that Windows will not even allow an application (whether 32-bit or 64-bit) to handle pointers that have an address above 0x7FFFFFFF (2GB or above) unless they have been specially marked as "LARGE_ADDRESS_AWARE" because so many applications will treat the pointer as a negative value at some point and fall over.

like image 21
Michael Burr Avatar answered Nov 15 '22 19:11

Michael Burr