views:

408

answers:

5

Would a C++ CLI compiler be able to compile some large sets of C++ classes without modifications?

Is C++ CLI a superset of C++?

+7  A: 

According to Wikipedia:

C++/CLI should be thought of as a language of its own (with a new set of keywords, for example), instead of the C++ superset-oriented Managed C++

Steve Klabnik
Although even most of the new keywords are contextual and can be used as identifiers in other code.
Eclipse
+3  A: 

technically no, but depending how standard the C++ code is, you'll probably be just fine. when you get into windows stuff you may run into issues. I compiled the whole game engine we use at work in C++/CLI once and it worked just fine. A colleague did the same for all of mozilla and no such luck.

Dustin Getz
+2  A: 

I'm still new with my learning curve on C++/CLI -- but I've had the same question myself, and what I've determined so far is that C++/CLI is, as a language, a superset of standard C++.

If you don't use the CLI extensions, your C++ code will end up as native unmanaged code, and should be essentially the same, but compiled to the CLR IL, instead of native x86.

Once you start using the CLI extensions (and start falling into the use of objects/handle/managed classes), you start interacting with the underlying CLR platform more heavily. At that point, it essentially becomes a new "language", and you'll have to separate your thinking between the "unmanaged" side and the "managed" side.

Toybuilder
A: 

Page 3 of Marcus Heege's book 'Expert C++/CLI.NET for Visual C++ Programmers' states:

C++/CLI is a set of extensions made to the C++ language to benefit from the services that an implementation of the CLI offers.

And further down the same page:

C++/CLI is a superset of the C++ language.

His excellent book is available for free from here.

Simon Brangwin
A: 

C++/CLI is not a superset of C++. It rather is a subset with additions. E.G. C++/CLI does not support multiple inheritance.

Angelo

Angel O'Sphere
No multiple inheritance? Where did you see this?
Gabe
In the documentation? All CLI languages only support single inheritance. However perhaps you can do MI with unmanaged code, never checked that.
Angel O'Sphere
Hm, I read up on wikipedia a bit. I did not catch that C++/CLI "replaced" Managed C++. Unfortunately the Wikipedia article is not stating under wich circumstances C++/CLI supports MI.
Angel O'Sphere