views:

195

answers:

2

Hello,

I find C++ is very controversial language in microsoft world. By default we have 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?

+7  A: 

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.

Dani
where are these?
claws
Project properties. Right click on a C++ project and select properties.
jalf
claws
I still can't find it. I only found "Common Language Runtime Support (/clr)" in "Project Properties > Configuration Properties > General". Rest of them I still can't find.
claws
the c++/c is in advanced section, and the ANSI is in the Language section.what version of VS do you use ?
Dani
A: 

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.

jalf