Skip to content

Latest commit

 

History

History
106 lines (88 loc) · 5.32 KB

SupportedC++Features.md

File metadata and controls

106 lines (88 loc) · 5.32 KB

Supported C++ Features

Minimum Compiler Support

OS Architecture Build Compiler Version
Linux ARMv7 g++ 7.3
Linux AArch64 g++ 7.3
Linux x86/x86-64 g++ 7.3
Linux s390x g++ 7.3
Linux ppc64le g++ 7.3
AIX ppc64 XLC 13.1.3
z/OS s390x XLC v2r3
macOS x86-64 XCode 12 Documentation available here with an Apple Developer account
macOS AArch64 XCode 13 Documentation available here with an Apple Developer account
Windows x86-64 MSVC 19 Visual Studio 2017

External Resources

Using the C++ Standard Library

  • The C++ standard library is not fully implemented in XLC.
  • The GC disallows linking against the C++ standard library. Header-only utilities are allowed, but likely unavailable.
  • The compiler makes heavy use of the C++ standard library, and statically links the stdlib whenever possible.
  • The C standard library is used everywhere. Where possible, prefer to use OMR's port and thread libraries.

Exceptions in OMR

  • The C++ standard library requires exceptions in order to function reasonably.
  • Don't use RAII types or std containers when exceptions are disabled.
  • The Compiler and JitBuilder have exceptions enabled.
  • All other components, including port, thread, and GC, have exceptions disabled.
  • MSVC does not allow exception specifiers in code (eg throw(), noexcept, when exceptions are disabled.

Supported C++11 features

OMR is written in a pre-standardization dialect of C++11. The supported language and library features are set by the minimum compiler versions we support.

  • Strongly-typed/scoped enums: enum class
  • Rvalue references and move semantics: template <typename T> T Fn(T&& t); (V2.0--MSVC 2010)
  • Static assertions: static_assert
  • auto-typed variables auto i = 1; (V1.0--MSVC 2010)
  • Trailing function return types: auto f() -> int
  • Declared type of an expression: decltype(expr) (V1.0--MSVC 2010)
  • Right angle brackets: template <typename T = std::vector<int>>
  • Delegating constructors: MyStruct() : MyStruct(NULL) {}
  • Extern templates
  • Variadic macros: #define m(p, ...), __VA_ARGS__
  • __func__ macro
  • long long

Unsupported C++11 Features

  • SFINAE (MSVC 2010)
  • Generalized constant expressions: constexpr (MSVC 2010)
  • Initializer lists: std::vector<int> v = { 1, 2, 3 }; (MSVC 2010)
  • Type and template aliases: using MyAlias = MyType; (MSVC 2010)
  • Variadic templates: template <class... Ts>, sizeof... (MSVC 2010)
  • Defaulted and deleted functions (MSVC 2010, XLC 12.1)
  • Range based for loops: for (auto& x : container) { ... } (MSVC 2010)
  • Non throwing exception specifier: noexcept (MSVC 2010)
  • Inline namespaces: inline namespace inner {} (MSVC 2010)
  • Inheriting constructors (MSVC 2010)
  • Forward declarations for enums (MSVC 2010)
  • Extensible literals: 12_km (MSVC 2010)
  • Thread-local storage
  • Standard Layout Types: is_standard_layout<T>::value
  • Extended friend declarations
  • Unrestricted unions (MSVC 2010)
  • Unicode string literals
  • Extended integral types: <cstdint> (use <stdint.h> instead) (XLC)
  • Raw string literals
  • Universal character name literals
  • New character types: char16_t, char32_t (MSVC 2010)
  • Extended sizeof (sizeof nested structures) (XLC 12.1)
  • ref qualifiers on member functions: int my_member() &&; (MSVC 2010)
  • Lambda expressions and closures: [](int i) -> int { return i + 1; } (XLC v2r1)
  • Generalized attributes: [[attribute]] (XLC v2r1)
  • Null pointer constant: nullptr (XLC v2r1)
  • Alignment support: alignas, alignof (XLC v2r1)
  • Explicit conversion operators (XLC v2r1)