“首选32位”的目的是什么,在Visual Studio 2012中的设置,它实际上是如何工作? [英] What is the purpose of the "Prefer 32-bit" setting in Visual Studio 2012 and how does it actually work?

查看:1825
本文介绍了“首选32位”的目的是什么,在Visual Studio 2012中的设置,它实际上是如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

>

不清楚我怎么编译器会自动知道编译为64位时,它需要。它如何知道什么时候可以自信地定位32位?

It is unclear to me how the compiler will automatically know to compile for 64-bit when it needs to. How does it know when it can confidently target 32-bit?

我主要关心编译器如何知道编译时要指定哪个架构。

I am mainly curious about how the compiler knows which architecture to target when compiling. Does it analyze the code and make a decision based on what it finds?

推荐答案

很奇怪,没有人链接到博客条目 什么AnyCPU真正意味着.NET 4.5和Visual Studio 11

It is so strange that nobody links to the blog entry What AnyCPU Really Means As Of .NET 4.5 and Visual Studio 11:


在.NET 4.5和Visual Studio 11中,奶酪已被移动。大多数.NET项目的
默认值是AnyCPU,但现在AnyCPU的值超过
。还有一个附加子类型的AnyCPU,
任何CPU 32位首选,这是新的默认(总体来说,有
现在是/ platform C#编译器开关的五个选项:x86,
Itanium,x64,anycpu和anycpu32bitpreferred)。当使用AnyCPU的
风格时,语义如下:

In .NET 4.5 and Visual Studio 11 the cheese has been moved. The default for most .NET projects is again AnyCPU, but there is more than one meaning to AnyCPU now. There is an additional sub-type of AnyCPU, "Any CPU 32-bit preferred", which is the new default (overall, there are now five options for the /platform C# compiler switch: x86, Itanium, x64, anycpu, and anycpu32bitpreferred). When using that flavor of AnyCPU, the semantics are the following:


  • 如果进程在32位Windows系统上运行,它作为32位进程运行。 IL被编译为x86机器码。

  • 如果进程在64位Windows系统上运行,则它将作为32位进程运行。 IL被编译为x86机器码。

  • 如果进程在ARM Windows系统上运行,则它将作为32位进程运行。 IL编译为ARM机器代码。

任何CPU 32位优先 x86是
只有这样:编译到x86的.NET应用程序将无法在
ARM Windows系统上运行,但是任何CPU 32位首选项应用程序将
成功运行。

这篇关于“首选32位”的目的是什么,在Visual Studio 2012中的设置,它实际上是如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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