是 C++ CLI 是 C++ 的超集?
C++ CLI 编译器是否能够在不进行修改的情况下编译一些大型 C++ 类集?
C++ CLI 是 C++ 的超集吗?
Would a C++ CLI compiler be able to compile some large sets of C++ classes without modifications?
Is C++ CLI a superset of C++?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
C++/CLI 不是 C++ 的超集。 相反,它是一个带有附加内容的子集。 EG C++/CLI 不支持多重继承。
安吉洛
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
Marcus Heege 的书《Expert C++/CLI.NET for Visual C++ Programmers》第 3 页指出:
并在同一页面的下方:
他的优秀著作可从此处免费获得。
Page 3 of Marcus Heege's book 'Expert C++/CLI.NET for Visual C++ Programmers' states:
And further down the same page:
His excellent book is available for free from here.
我能够将整个 Qt 库(很大)编译为 C++/CLI,并进行微小修改(主要是在构建环境中,但也修复了 Qt 源代码中的一个错误)
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)
根据 维基百科:
According to Wikipedia:
从技术上讲不可以,但是根据 C++ 代码的标准程度,您可能会没事。 当你接触 Windows 的东西时,你可能会遇到问题。 我用 C++/CLI 编译了我们在工作中使用的整个游戏引擎一次,它运行得很好。 一位同事对整个 mozilla 做了同样的事情,但没有这样的运气。
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.
我对 C++/CLI 的学习曲线还很陌生——但我自己也有同样的问题,到目前为止我已经确定,C++/CLI 作为一种语言,是标准 C++ 的超集。
如果您不使用 CLI 扩展,您的 C++ 代码最终将成为本机非托管代码,并且本质上应该是相同的,但编译为 CLR IL,而不是本机 x86。
一旦开始使用 CLI 扩展(并开始使用对象/句柄/托管类),您就开始更频繁地与底层 CLR 平台进行交互。 到那时,它本质上成为一种新的“语言”,您必须将您的思维分为“非托管”方面和“托管”方面。
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.