是 C++ CLI 是 C++ 的超集?

发布于 2024-07-06 11:25:58 字数 164 浏览 6 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

一场信仰旅途 2024-07-13 11:25:59

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

我乃一代侩神 2024-07-13 11:25:59

Marcus Heege 的书《Expert C++/CLI.NET for Visual C++ Programmers》第 3 页指出:

C++/CLI 是一组扩展
C++ 语言受益于
实施的服务
CLI 提供。

并在同一页面的下方:

C++/CLI 是 C++ 语言的超集。

他的优秀著作可从此处免费获得。

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.

夜雨飘雪 2024-07-13 11:25:59

我能够将整个 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)

泪之魂 2024-07-13 11:25:58

根据 维基百科

C++/CLI 应该被视为一种自己的语言(例如,具有一组新的关键字),而不是面向 C++ 超集的托管 C++

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

一人独醉 2024-07-13 11:25:58

从技术上讲不可以,但是根据 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.

诺曦 2024-07-13 11:25:58

我对 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文