Skip to main content
some grammar fixed
Source Link
Tulains Córdova
  • 39.5k
  • 13
  • 99
  • 155

Most software will work the same when compiled for both the 32 and 64 bit Intel/AMD architectures. However, some software will not. Aside from laziness, or reaching a larger audience, there are some specific reasons why recompiling as 64 bit will not work.

  • Software may use unsafe pointer operations. Perhaps a program puts a pointer into an int, which is generally 32 bit for most C and C++ compilers. Pointers are 64 bits in a 64 bit program. That does not work.

  • Bit shift operations may produce different results if the integer type being used is a different size. This may be an issue when using a regular data type instead of a standard typedef such as int32_t

  • A data type used in a union may change sizes, changing the behavior of the union.

  • Software may rely on libraries that are 32-bit only. In general, a 64 bit program will only work with 64 bit libraries due to assumptions about the stack, pointers, etc.

The difficulty you ask about in your question is simply that in some code bases there may be millions of lines of code that performsperform unsafe operations, makesmake unsafe assumptions, hashave shortcuts and clever "optimizations" put in by developers. The code will either not compile in a 64 bit environment, or it will compile but have show-stopper bugs. It may take a long time to fix all the issues. Maybe a company will fix them over time until it is possible to release a 64 bit version. Maybe a company will develop a "version 2" alongside current maintenance releases because a total rewrite is necessary.

The moral of the story is to write clean code and do not try to second-guess the compiler or add clever optimizations that are not needed, can break the software, and probably do not help anyway.

This article goes into far more detail than I could hope to include in this questionanswer: 20 issues of porting C++ code on the 64-bit platform

Most software will work the same when compiled for both the 32 and 64 bit Intel/AMD architectures. However, some software will not. Aside from laziness, or reaching a larger audience, there are some specific reasons why recompiling as 64 bit will not work.

  • Software may use unsafe pointer operations. Perhaps a program puts a pointer into an int, which is generally 32 bit for most C and C++ compilers. Pointers are 64 bits in a 64 bit program. That does not work.

  • Bit shift operations may produce different results if the integer type being used is a different size. This may be an issue when using a regular data type instead of a standard typedef such as int32_t

  • A data type used in a union may change sizes, changing the behavior of the union.

  • Software may rely on libraries that are 32-bit only. In general, a 64 bit program will only work with 64 bit libraries due to assumptions about the stack, pointers, etc.

The difficulty you ask about in your question is simply that in some code bases there may be millions of lines of code that performs unsafe operations, makes unsafe assumptions, has shortcuts and clever "optimizations" put in by developers. The code will either not compile in a 64 bit environment, or it will compile but have show-stopper bugs. It may take a long time to fix all the issues. Maybe a company will fix them over time until it is possible to release a 64 bit version. Maybe a company will develop a "version 2" alongside current maintenance releases because a total rewrite is necessary.

The moral of the story is to write clean code and do not try to second-guess the compiler or add clever optimizations that are not needed, can break the software, and probably do not help anyway.

This article goes into far more detail than I could hope to include in this question: 20 issues of porting C++ code on the 64-bit platform

Most software will work the same when compiled for both the 32 and 64 bit Intel/AMD architectures. However, some software will not. Aside from laziness, or reaching a larger audience, there are some specific reasons why recompiling as 64 bit will not work.

  • Software may use unsafe pointer operations. Perhaps a program puts a pointer into an int, which is generally 32 bit for most C and C++ compilers. Pointers are 64 bits in a 64 bit program. That does not work.

  • Bit shift operations may produce different results if the integer type being used is a different size. This may be an issue when using a regular data type instead of a standard typedef such as int32_t

  • A data type used in a union may change sizes, changing the behavior of the union.

  • Software may rely on libraries that are 32-bit only. In general, a 64 bit program will only work with 64 bit libraries due to assumptions about the stack, pointers, etc.

The difficulty you ask about in your question is simply that in some code bases there may be millions of lines of code that perform unsafe operations, make unsafe assumptions, have shortcuts and clever "optimizations" put in by developers. The code will either not compile in a 64 bit environment, or it will compile but have show-stopper bugs. It may take a long time to fix all the issues. Maybe a company will fix them over time until it is possible to release a 64 bit version. Maybe a company will develop a "version 2" alongside current maintenance releases because a total rewrite is necessary.

The moral of the story is to write clean code and do not try to second-guess the compiler or add clever optimizations that are not needed, can break the software, and probably do not help anyway.

This article goes into far more detail than I could hope to include in this answer: 20 issues of porting C++ code on the 64-bit platform

Source Link
user22815
user22815

Most software will work the same when compiled for both the 32 and 64 bit Intel/AMD architectures. However, some software will not. Aside from laziness, or reaching a larger audience, there are some specific reasons why recompiling as 64 bit will not work.

  • Software may use unsafe pointer operations. Perhaps a program puts a pointer into an int, which is generally 32 bit for most C and C++ compilers. Pointers are 64 bits in a 64 bit program. That does not work.

  • Bit shift operations may produce different results if the integer type being used is a different size. This may be an issue when using a regular data type instead of a standard typedef such as int32_t

  • A data type used in a union may change sizes, changing the behavior of the union.

  • Software may rely on libraries that are 32-bit only. In general, a 64 bit program will only work with 64 bit libraries due to assumptions about the stack, pointers, etc.

The difficulty you ask about in your question is simply that in some code bases there may be millions of lines of code that performs unsafe operations, makes unsafe assumptions, has shortcuts and clever "optimizations" put in by developers. The code will either not compile in a 64 bit environment, or it will compile but have show-stopper bugs. It may take a long time to fix all the issues. Maybe a company will fix them over time until it is possible to release a 64 bit version. Maybe a company will develop a "version 2" alongside current maintenance releases because a total rewrite is necessary.

The moral of the story is to write clean code and do not try to second-guess the compiler or add clever optimizations that are not needed, can break the software, and probably do not help anyway.

This article goes into far more detail than I could hope to include in this question: 20 issues of porting C++ code on the 64-bit platform