C++0x 实现猜测?

发布于 2024-07-12 02:37:29 字数 265 浏览 10 评论 0原文

C++0x 标准即将完成。 到目前为止,我已经涉足了 C++,但避免彻底学习它,因为它似乎缺少许多我在其他语言中被宠坏的现代功能。 然而,我对 C++0x 非常感兴趣,它解决了我的很多抱怨。 在标准获得批准后,您是否可以猜测主要编译器供应商需要多长时间才能提供相当完整的、生产质量的实现? 它会很快扭转 C++ 受欢迎程度的下降趋势吗?还是太少、太晚了? 您是否相信 C++0x 将在几年内成为“C++”,或者您是否认为大多数人会在实践中坚持早期的标准,而 C++0x 将有点像一个混蛋继子,有点像C99?

The C++0x standard is on its way to being complete. Until now, I've dabbled in C++, but avoided learning it thoroughly because it seems like it's missing a lot of modern features that I've been spoiled by in other languages. However, I'd be very interested in C++0x, which addresses a lot of my complaints. Any guesstimates, after the standard is ratified, as to how long it will take for major compiler vendors to provide reasonably complete, production-quality implementations? Will it happen soon enough to reverse the decline in C++'s popularity, or is it too little, too late? Do you believe that C++0x will become "the C++" within a few years, or do you believe that most people will stick to the earlier standard in practice and C++0x will be somewhat of a bastard stepchild, kind of like C99?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(5

执妄 2024-07-19 02:37:29

我认为没有理由不采用 C++0x。 C++ 社区比 C 更具前瞻性。C 一直被认为是一种“可移植汇编语言”,因此使用它的人对花哨的新功能并不是非常感兴趣。 C++ 的范围要广泛得多,而且我还没有听说过哪个 C++ 程序员不期待 0x。 (我的印象是 C++ 社区更加“严格”,并且真的不想超出标准而进入未定义的行为,这意味着您选择 C++03 或 C++0X,而不是半实现的混合型 C 程序员往往对此更加放松,并且似乎很乐意使用仅混合了一些 C99 功能和头文件的 C89。)

但是,至少需要几年时间微软才能赶上。 Visual Studio 2010 将支持一小部分 C++0x 功能(lambda、decltype 和其他一些功能),但绝大多数将受到支持。 我们必须等待 VS2012 或无论下一个版本最终是什么,才能获得稍微完整的支持。

对于 GCC/G++,情况要好得多,因为大多数标准已经在那里实现(标准委员会不喜欢采用尚未在真实编译器中实现和测试的功能,并且 GCC 分支是经常用于此目的)

但可能仍需要一些时间才能达到稳定并为生产做好准备。

对于C++的“流行度下降”,我实在看不出来。 我认为 C++ 的受欢迎程度在过去几年中并没有显着下降。 当然,RAD 开发人员已经转向 .NET、Python 或其他语言或平台。 但如今使用 C++ 的地方,并没有太多可行的替代方案,因此它的受欢迎程度也没有理由下降。

I see no reason why C++0x shouldn't be adopted. The C++ community is much more forward-looking than C. C was always meant to be a "portable assembler language", so people who use that aren't really super interested in fancy new features. C++ spans much wider, and I've yet to hear of a C++ programmer who wasn't looking forward to 0x. (It's also my impression that the C++ community is much "stricter", and really don't want to move outside the standard into undefined behavior, which implies you choose either C++03 or C++0X rather than a half-implemented hybrid. C programmers tend to be much more relaxed about that, and seem happy to use C89 with just a couple of C99 features and headers mixed in)

However, it'll take a few years before Microsoft catches up, at least. Visual Studio 2010 will support a small handful of C++0x features (lambdas, decltype and a couple of others), but the vast majority will not be supported. We'll have to wait for VS2012 or whatever the next version ends up being, to have somewhat complete support.

With GCC/G++, the situation is a lot better, since most of the standard has been implemented there already (the standard committee doesn't like adopting features that haven't been implemented and tested in a real compiler, and a GCC fork is often used for that)

But it'll probably still take some time to get that stable and production-ready.

About C++'s "decline in popularity", I don't really see it. I don't think C++ has declined significantly in popularity for the last years. RAD developers have already jumped ship, of course, to .NET, Python or other languages or platforms. But where C++ is used today, there aren't many viable alternatives, and no reason why it should decline in popularity.

如歌彻婉言 2024-07-19 02:37:29

我不知道其他供应商,但来自 什么 我已经可见,微软计划在 Visual C++ 2010 中包含四种 C++0x 语言功能:

  1. 右值引用
  2. auto
  3. lambda
  4. 静态断言

虽然这是一小部分 C++0x 功能,但它们很重要。 有些将使程序员能够编写更紧凑(自动、lambda)和无错误的代码。 有些(如右值引用)使库变得更加高效。 Microsoft 喜欢将 lambda 作为并行计算的推动者

恕我直言:仅 auto 就可以让使用模板变得更加容易,以至于更多的程序员会这样做。 希望这会增加 Microsoft 和所有供应商对更多 C++0x 功能的需求。

Microsoft 还将更新他们的 C++ 标准库实现,但我不知道细节。 我相信他们正在修改一些容器类以利用右值引用移动语义。 我相信他们包括更多的 TR1 。

I don't know about other vendors, but from what I've seen, Microsoft plans to include four C++0x language features in Visual C++ 2010:

  1. rvalue references
  2. auto
  3. lambdas
  4. static assert

Although this is a small set of C++0x features, they are important ones. Some will enable programmers to write much more compact (auto, lambdas) and error free code. Some (like rvalue references) enable libraries to be more efficient. Microsoft likes lambdas as an enabler for parallel computing.

IMHO: auto alone will make it so much easier to use templates that more programmers will do so. And hopefully this will increase demand for more C++0x features from Microsoft and all vendors.

Microsoft will also be updating their C++ Standard Library implementation but I don't know the details. I believe they are modifying some container classes to take advantage of rvalue reference move semantics. And I believe they including more of TR1 .

倾城月光淡如水﹏ 2024-07-19 02:37:29

一些实现已经在向 C++0x 迈进:(gcc)。 我的直觉表明,C++0x 支持将很快在主要编译器中提供; 然而,仍然存在大量必须维护的遗留代码。

Some implementations are already on their way to C++0x: (gcc). My intuition says that C++0x support will be available in major compilers fairly quickly; however a large body of legacy code still exists that must be maintained.

白云不回头 2024-07-19 02:37:29

较新版本的 gcc 已经支持许多 C++0x 功能: http://gcc.gnu .org/projects/cxx0x.html

Newer versions of gcc already support many of the C++0x features: http://gcc.gnu.org/projects/cxx0x.html

感悟人生的甜 2024-07-19 02:37:29

Microsoft 将在今年晚些时候在 Visual Studio 2010 中加入 C++0x 支持(社区技术预览版已经可用)。

我认为它不会很快成为“C++”,但某些人会选择在其代码中有意义的地方添加部分新语法。

如今,我对 C++ 的了解不多,但与我交谈的人要么喜欢它,要么觉得 C++ 的美妙之处在于他们所获得的控制,如果他们想要一种具有所有这些额外功能的语言,他们会使用 C# /Java。

Microsoft will be including C++0x support in Visual Studio 2010 later this year (a community technology preview is already available).

I don't think it'll become "the C++" any time soon, but rather certain people will choose to add parts of the new syntax where it makes sense in their code.

I don't do much C++ these days, but people I talk to either love it, or feel that the beauty of C++ is in the control they get, and that if they wanted a language with all those extra features they'd use C#/Java.

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