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

£可爱£侵袭症+ 提交于 2019-11-28 07:08:35

问题


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

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


回答1:


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.




回答2:


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++




回答3:


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.




回答4:


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




回答5:


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.




回答6:


I was able to compile whole Qt library (which is huge) as C++/CLI with minor modifications (mostly in the build environment, but also fixed one bug in Qt source code)



来源:https://stackoverflow.com/questions/179684/is-c-cli-a-superset-of-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!