system
Given the following post, respond as if you're commenting on Reddit:
human
When could porting a x32 app to x64 be challenging?

I've been reading some internet debates about Visual Studio remaining 32bit, and that is the inspiration for this question. I'm interested to understand why it would be difficult porting a 32bit code base to 64bit. Presuming something like c++ was used, I'm not aware of any design-time changes a developer needs to make based on whether their app will be 32 bit vs 64 bit... its just a compiler switch. Is the reliance on 32bit 3rd party components the only hiccup? 

&#x200B;

No doubt I'm just ignorant! I'd appreciate someone schooling me on this :D In what ways could compiling to 64 bit break your program?
gpt
It entirely depends on the assumptions baked into the code. it might be trivially easy or literally impossible to do without rewriting the entire thing.

Someone who coded an application well might never have relied on the binary layout of the pointer. Anytime the code needed a location to write files to they might have intelligently query the system. Maybe every time pointer arithmetic is done it is done in such a way where the math doesn't directly include the size of the pointer.

Then again it's entirely possible that the people who wrote the code presumed the upper bits of the pointer would always be unused and stuffed to important metadata there. It is possible that they presumed but they would always get to write to the "program files" directory, and never bothered to ask if there ever be a "program files x86". It is also possible and you'll see the magic number 4 or 32 sprinkled all throughout the code instead of correct usage of sizeof.

Any time a person could have made an assumption in the code they might have made that assumption, or they might have figured out a way to have the build system, the operating system, or some other system provide a correct value wherever the software is supposed to be built or run.