32 位环境编程与 64 位环境编程/构建配置

发布于 2024-09-04 10:16:28 字数 358 浏览 6 评论 0原文

我最近正在查看一些具有多个构建配置(发布/调试、Win32/x64)的相同代码(示例 MS Visual Studio C++ 项目)。

我的问题:有什么区别?我想我理解发布/调试(发布=项目的最终版本,调试=用于在调试器中运行的版本),但是为Win32/x64平台构建不同版本时需要考虑哪些事情?是否存在任何编码差异,或者这是否仅影响相同代码最终构建到机器代码中的方式?

我知道有不同的库文件,具体取决于您使用的是 32 位还是 64 位系统...所有这些差异都只是机器代码吗? 32 位库文件及其对应的 64 位库文件是否是两个具有完全相同功能的文件,它们最初是从相同的源代码构建的,仅在机器代码实现上有所不同?

谢谢!

——拉塞尔

I was looking at some same code (a sample MS Visual Studio C++ project) recently with multiple build configurations (Release/Debug, Win32/x64).

My question: What is the difference? I guess I understand Release/Debug (Release = finalized version of project, Debug = version used to run in debugger), but what things need to be considered when building different versions for Win32/x64 platforms? Is there any coding differences, or does this just affect how that same code is ultimately built into machine code?

I know there are different library files depending on whether you're using a 32-bit or 64-bit system as well... Are all of these differences again just machine code? Would a 32-bit library file and its corresponding 64-bit library file be two files with exactly the same functions build from the same source code originally, and only differing in their machine code implementation?

Thanks!

--Russel

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒中人 2024-09-11 10:16:28

代码的编写方式可能有所不同,但只要稍加注意,大多数代码都非常容易编写,因此它可以作为 32 位或 64 位可执行文件编译和运行良好。当/如果您执行诸如假设 Windows 类型之间的相似性之类的操作(例如,DWORD 将保存指针 - 在 32 位代码中是这样,但在 64 位代码中则不然)时,大多数问题都会出现。

另请注意,32 位编译器的最后几次迭代有一个警告,您可以启用无法移植到 64 位执行的代码(并且它似乎非常有效和准确)。

There can be differences in how the code is written, but with a bit of care most code is pretty easy to write so it compiles and runs fine as either a 32-bit or 64-bit executable. Most of the problems arise when/if you do things like assuming similarity between Windows types (e.g., that a DWORD will hold a pointer -- true in 32-bit code but not in 64-bit code).

Also note that the last few iterations of the 32-bit compiler have had a warning you could enable for code that wouldn't port to 64-bit execution (and it seems pretty effective and accurate).

烟沫凡尘 2024-09-11 10:16:28

x32 运行占用空间更小。 “字”更小(32 位与 64 位)。一般来说,x64 位操作系统非常棒,因为它们允许应用程序使用超过 4 GB 的 RAM。但是,除非您使用数据库等大型软件,否则 32x 通常运行速度更快、效率更高,尤其是在 x64 位操作系统上。

x32 runs a smaller footprint. "Words" are smaller (32bit vs 64bit). Generally, x64 bit operating systems are fantastic as they let apps use more than four gigabytes of RAM. However, unless you are using massive software like a database, 32x generally runs faster and more efficiently, especially on x64 bit operating systems.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文