c++ - C++11 (C++0x) 是完整的 C++03 超集吗?

标签 c++ c++11

C++ 被认为是(几乎)C 的超集;但仍有某些东西在 C 中有效,而在 C++ 中无效。

是否有任何功能/设施是有效的 C++03 但在 C++11 中不起作用?

最佳答案

Is there any feature/facility which is a valid C++03 but not working in C++11 ?

有一些不兼容的地方:

  • export template 被移除(不被弃用,真正被移除)
  • 您不能再使用 auto 作为存储说明符
  • 新增保留字:alignofchar16_tchar32_tconstexprdecltypenoexceptnullptrstatic_assertthread_local

另外,对于 future 的版本:

  • std::auto_ptr 已弃用
  • 不推荐使用抛出规范

也许我错过了其他人,但如果你的代码使用了这些,你将不得不修复它。

几乎所有 C++2003 功能仍然相同或更精确地为 C++2011 中的编译器实现指定。

关于c++ - C++11 (C++0x) 是完整的 C++03 超集吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6293075/

相关文章:

c++ - static_assert 意外行为

c++ - 混合 std::move() 和 std::thread 不会编译

c++ - std::is_default_constructible<T> 错误,如果构造函数是私有(private)的

c++ - 如何在多个排序列表上创建迭代器?

c++ - 弹道曲线问题

c++ - 如何在另一个 C++ 程序中使用预处理的 .i 文件?

c++ - MSVC 错误 - 错误 C2373 : 'description' : redefinition; different type modifiers

c++ - 关于 union 和堆分配内存的问题

c++ - 如何获取匹配组的索引

c++ - 通过初始化列表在构造函数中初始化类成员( vector )