编程的32位环境VS编程的64位环境/编译配置 [英] Programming for a 32-bit environment vs programming for a 64-bit environment / Build configurations

查看:275
本文介绍了编程的32位环境VS编程的64位环境/编译配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一些相同的code(样本MS Visual Studio的C ++项目),最近与多个构建配置(发布/调试的Win32 / 64)。

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

我的问题:有什么区别?我想我明白了发布/调试(发布=最终确定项目的版本,调试=版本用于在调试器中运行),但在Win32 / x64平台构建不同的版本时,需要考虑些什么东西?是否有任何编码差异,或者这是否只是会影响同一code为最终建成为机器code?

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?

我知道有这取决于您使用的是32位还是64位系统,以及不同的库文件...是所有这些差异又只是机器code?将一个32位的库文件及其相应的64位库文件是两个文件具有完全相同的功能,从同一来源$ C ​​$ C建立最初,只有不同在他们的机器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?

谢谢!

- 罗素

推荐答案

可以有怎样的code被写入的差异,但有一点照顾最code是pretty的容易写所以它编译和运行细无论是作为32位或64位可执行文件。如果你不喜欢的东西的Windows类型之间的假设相似性( - 32位code真实的,但不是在64位code,例如,一个DWORD将举行一个指针)时,大多数问题出现/。

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).

另外请注意,在32位编译器的最后几个迭代都产生了警告,你可以启用code表示不会移植到64位执行(这似乎pretty的有效和准确)

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).

这篇关于编程的32位环境VS编程的64位环境/编译配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆