dxx-rebirth/Documentation/c++std.markdown
Kp aee963c015 Switch dialect to C++20
Future commits will introduce tests for and uses of C++20 features.
2022-07-02 18:10:45 +00:00

5 KiB

DXX-Rebirth requires a compiler that implements the C++20 standard. A fully conforming compiler is recommended, but some omissions can be handled by SConf tests that enable a fallback to emulate the feature.

Required C++11 features

DXX-Rebirth code uses C++11 and C++14 features present in >=clang-9.0 and >=gcc-7.5. Some of these features are probed in the SConf tests so that an error can be reported if the feature is missing. However, since these are considered the minimum supported compiler versions, and existing SConf tests reject older compilers, some C++14 features that are new in gcc-7.5 may be used without a corresponding test in SConf.

These C++11 features are required to build DXX-Rebirth:

Required C++14 features

  • std::index_sequence is a compile-time sequence of integers.
  • std::exchange is a utility to update a variable, and yield the value it had before the update
  • std::make_unique is a convenience utility function for constructing std::unique_ptr with a managed value.

Optional C++11/C++14 features

DXX-Rebirth code may use C++11 or C++14 features not present in the minimum supported compiler if the feature can be removed by a macro and the removal does not change the correctness of the program (C++11: rvalue-qualified member methods).

Optional C++11 features

Preprocessed out if absent

  • Reference-qualified methods check that an rvalue which may or may not hold a valid pointer is not used in a context where the caller assumes the rvalue holds a valid pointer. When the rvalue may or may not hold a valid pointer, it must be saved to an lvalue, tested for a valid pointer, and used only if a valid pointer is found.