开发者

Which C++ does Visual Studio 2008 (or later) use?

I find C++ is very controversial language in microsoft world. By default we ha开发者_运维技巧ve ISO C++ and then microsoft has Managed C++ and now C++ CLI.

I just know standard (ISO) C++. I don't know microsoft's version of C++.

I'm confused about interpretation of any c++ code by visual studio 2008 (or later). Thats why I'm using gnu tools for compiling my programs. But I do love Visual Studio.

What settings do I need to make if I only want to use

  1. STRICTLY ISO C++
  2. Managed C++ (its deprecated but I think they still support it for sake of backward compatibility)
  3. C++ CLI (for .NET platform)

I want to build native assemblies using C++ not managed ones. So, is there anything else should I need to do?


Everything is in the build settings:

Common Language Runtime Support (/clr) - add or remove CLR support

Advance Compile as C++ Code (/TP) - to choose if c++ or c..

Language: Disable Language Extention - use this to force ANSI.


When you ask Visual Studio to make a C++ project, it makes a C++ project. C++/CLI is a different language.

VS2008 and earlier have implemented C++03 (or approximated it. Like almost every other compiler, there are bits of the standard that are not followed to the letter. A few features are not implemented (exception specifications, the export keyword or two-phase name lookup are the ones I can think of), and some proprietary extensions are added as well.

GCC, and most big compilers, do the exact same thing, so this isn't a case of Microsoft being "evil" as such. The extensions can be disabled, leaving you with a reasonably standards-compliant compiler.

VC2010 is adding a number of C++0x features (and at least in the beta, I haven't been able to find an option to disable these), so from a strict C++03 compliance point of view, it is going to be less compliant.

Dani's answer already tells you which settings to change to enable/disable different language dialects.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜