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
作为存储说明符 - 新增保留字:
alignof
、char16_t
、char32_t
、constexpr
、decltype
、noexcept
、nullptr
、static_assert
和thread_local
另外,对于 future 的版本:
std::auto_ptr
已弃用- 不推荐使用抛出规范
也许我错过了其他人,但如果你的代码使用了这些,你将不得不修复它。
几乎所有 C++2003 功能仍然相同或更精确地为 C++2011 中的编译器实现指定。
关于c++ - C++11 (C++0x) 是完整的 C++03 超集吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6293075/