You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cpp/style.rst
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,24 +84,25 @@ These tasks are made much simpler if the code is easily readable and well-docume
84
84
85
85
.. _style-guide-cpp-2-2:
86
86
87
-
2-2. We are writing C++17
87
+
2-2. We are writing C++20
88
88
-------------------------
89
89
90
-
We follow the official: International Standard ISO/IEC 14882:2017(E) – Programming Language C++, without any compiler specific extensions.
90
+
We follow the official: International Standard ISO/IEC 14882:2024(E) – Programming Language C++, without any compiler specific extensions.
91
91
92
92
.. note::
93
93
94
94
We use compilers provided by a specific :ref:`Conda environment <platforms-environment>` executing on a defined :ref:`baseline platform <platforms-baseline>`.
95
-
This environment provides complete support for C++17, but --- in the case of compiler bugs --- the allowed set of C++17 features is those which can be shown to work properly in this reference environment.
95
+
This environment provides complete support for C++20, but the allowed set of C++20 features is limited to those that can be shown to work properly in this reference environment.
96
96
In practice, we further restrict the feature set to those that also work on our commonly-tested platforms.
97
97
98
-
The C++17 standard adds a number of useful features such as nested namespace definitions, structured binding declarations, initializers in ``if`` and ``switch`` statements, class template argument deduction, ``std::optional``, ``std::any``, ``std::filesystem``, and ``std::variant``.
99
-
A parallel algorithms library has also been added, although use of this in Science Pipelines code should be vetted, as we typically use one-core-per-process parallelization.
100
-
``std::auto_ptr`` has been removed and should typically be replaced by ``std::unique_ptr``.
98
+
The C++20 standard adds a number of useful features such as struct initialization with named fields, ``consteval`` and ``constinit``, improvements to ``constexpr``, the three-way comparison operator (``<=>``), and improved ``lambdas``.
99
+
It also includes enhancements of the standard library including ``ranges``, definition of mathematical constants in ``<numbers>``, ``std::format``, ``std::span``, improved calendar and timezone support in ``chrono``.
101
100
102
-
When using C++17 features, be careful about readability for developers familiar only with C++14.
101
+
The use of ``modules`` is discouraged. The use of ``concepts`` and ``coroutines`` should be evaluated carefully.
103
102
104
-
If you find that any Style Guide rules conflict with C++17 best practices, such as those in the `C++ Core Guidelines`_, please propose updates.
103
+
When using C++17 and C++20 features, be careful about readability for developers familiar only with C++14.
104
+
105
+
If you find that any Style Guide rules conflict with C++20 best practices, such as those in the `C++ Core Guidelines`_, please propose updates.
0 commit comments