Skip to content

Commit 9c6ada5

Browse files
Pim SchellartPim Schellart
authored andcommitted
Switch to C++14 and devtoolset-6
Implements RFC-332
1 parent 7439928 commit 9c6ada5

File tree

3 files changed

+37
-31
lines changed

3 files changed

+37
-31
lines changed

coding/cpp_style_guide.rst

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,29 @@ These tasks are made much simpler if the code is easily readable and well-docume
8484

8585
.. _style-guide-cpp-2-2:
8686

87-
2-2. We are writing C++11/14 with some restrictions.
88-
----------------------------------------------------
87+
2-2. We are writing C++14
88+
-------------------------
8989

90-
The official policy on the use of C++11 features is at :ref:`Policy on use of C++11/14 language features <style-guide-cpp-cpp-11-14>`.
90+
The C++11 standard and the C++14 improvements to it bring a number of useful language features that make the resulting code more expressive, easier to read, and safer.
91+
92+
We follow the official: International Standard ISO/IEC 14882:2014(E) – Programming Language C++, without any compiler specific extensions.
93+
94+
.. note::
95+
96+
Our minimum required compiler versions are:
97+
98+
* GCC 6.3.1 (Linux)
99+
* Clang 800.0.42.1 (macOS)
100+
101+
these both have complete support for C++14, but in case of compiler bugs the actually allowed set
102+
of C++14 features is the intersection of those supported by our compilers and the standard.
103+
104+
.. seealso::
105+
106+
- :ref:`pipelines:source-install-redhat-legacy` from the `LSST Science Pipelines <https://pipelines.lsst.io>`__ documentation.
107+
But note that installation instructions for stack versions 14.0 and below refer to our older baseline compilers.
108+
These are now superseded by the minimum required compiler versions listed above.
109+
- :doc:`/services/lsst-dev` provides :ref:`instructions for using devtoolset-6 <lsst-dev-tools>` to obtain a more modern GCC on LSST cluster machines.
91110

92111
.. _style-guide-cpp-2-3:
93112

@@ -1744,7 +1763,7 @@ This type of implicit conversion can result in incorrect and unintentional side
17441763
5-27a. Constructor calls SHOULD use C++98 syntax when possible.
17451764
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17461765

1747-
While C++11 introduces a new syntax for "uniform initialization" using braces, C++ objects in LSST code should be initialized using syntax that is valid in C++98 whenever possible, with brace initialization used only when necessary, such as when initializing aggregates or containers that take ``std::initializer_list`` arguments.
1766+
While a new syntax for "uniform initialization" using braces was introduced with C++11, C++ objects in LSST code should be initialized using syntax that is valid in C++98 whenever possible, with brace initialization used only when necessary, such as when initializing aggregates or containers that take ``std::initializer_list`` arguments.
17481767

17491768
In particular, default constructors should be called with no parentheses or braces. This avoids most occurrences of the `most-vexing parse problem <https://en.wikipedia.org/wiki/Most_vexing_parse>`_:
17501769

@@ -2626,23 +2645,6 @@ While it is not expected that we will bring the guts of all legacy code in line
26262645
.. [Google] Google C++ Style Guide, 2017. Available on-line at:
26272646
https://google.github.io/styleguide/cppguide.html
26282647
2629-
.. _style-guide-cpp-cpp-11-14:
2630-
2631-
Appendix: Policy on using C++11/14 Features
2632-
===========================================
2633-
2634-
The C++11 standard and the C++14 improvements to it bring a number of useful language features that make the resulting code more expressive, easier to read, and safer.
2635-
They are becoming well-implemented and widespread.
2636-
C++11/14 features supported by the default compiler provided with the oldest operating system distribution commonly used to install the LSST Stack, currently gcc 4.8.3, may be used at will in ``.cc`` and ``.h`` files.
2637-
2638-
.. seealso::
2639-
2640-
- :ref:`pipelines:source-install-redhat-legacy` from the `LSST Science Pipelines <https://pipelines.lsst.io>`__ documentation.
2641-
- :doc:`/services/lsst-dev` provides :ref:`instructions for using devtoolset-3 <lsst-dev-tools>` to obtain a more modern GCC on LSST cluster machines.
2642-
- C++11 compiler support matrix: http://wiki.apache.org/stdcxx/C++0xCompilerSupport.
2643-
2644-
C++11 uniform initialization syntax should in general *not* be preferred over C++98 construction syntax; see rule :ref:`5-27a <style-guide-cpp-5-27a>`.
2645-
26462648
.. _style-guide-cpp-using:
26472649

26482650
Appendix: On Using `Using`

coding/using_boost.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ Using Boost
1212

1313
A Boost library may be used only if:
1414

15-
1. the desired effect cannot be accomplished with a C++11 standard language feature, and
16-
2. a C++ standard library equivalent is either unavailable or unusable with our minimum supported compiler version (i.e. ``gcc`` version 4.8).
15+
1. the desired effect cannot be accomplished with a C++14 standard language feature, and
16+
2. a C++ standard library equivalent is either unavailable or unusable with our minimum required compiler version (i.e. ``gcc`` version 6.3.1).
1717

18-
In particular, the following Boost libraries are no longer accepted as they have standard equivalents in gcc 4.8 and above:
18+
In particular, the following Boost libraries are no longer accepted as they have standard equivalents in gcc 6.3.1 and above:
1919

2020
``array``
2121
use ``<array>``
2222

2323
``bind``
24-
prefer C++11 lambda functions instead, but use ``std::bind`` from ``<functional>`` if you must
24+
prefer C++14 lambda functions instead, but use ``std::bind`` from ``<functional>`` if you must
2525

2626
``cstdint``
2727
use ``<cstdint>``
@@ -30,7 +30,7 @@ In particular, the following Boost libraries are no longer accepted as they have
3030
use ``<filesystem>``
3131

3232
``lambda``
33-
use C++11 lambda functions
33+
use C++14 lambda functions
3434

3535
``lexical_cast``
3636
use ``std::to_string``, ``std::stoi``, ``std::stod`` etc.
@@ -51,7 +51,7 @@ In particular, the following Boost libraries are no longer accepted as they have
5151
use ``std::shared_ptr`` and ``std::unique_ptr`` (and its array specialization) from ``<memory>`` instead of ``boost::shared_ptr``, ``boost::scoped_ptr`` and ``boost::scoped_array``
5252

5353
``static_assert``
54-
use C++11 ``static_assert``
54+
use C++14 ``static_assert``
5555

5656
``tuple``
5757
use ``<tuple>``

teams/drp.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ When connecting to Tiger, you should connect to the head node ``tiger-sumire.pri
5151

5252
Tiger runs version 6.8 of `Springdale Linux <https://puias.math.ias.edu>`_ (a derivative of `RHEL <https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux>`_).
5353
As such, the default toolchain is too old to work with the LSST stack.
54-
You should therefore enable ``devtoolset-3`` before proceeding:
54+
You should therefore enable ``devtoolset-6`` before proceeding:
5555

5656
.. prompt:: bash
5757

58-
scl enable devtoolset-3 bash
58+
scl enable devtoolset-6 bash
5959

6060
A regularly-updated LSST “shared stack” is available in :file:`/tigress/HSC/LSST/stack_tiger/` (note that the name of the cluster is embedded in the path).
6161
To get started, try:
@@ -74,8 +74,12 @@ Unlike Tiger, there is no head node reserved for HSC/LSST use.
7474
Connect to ``perseus.princeton.edu``, and be especially considerate of other users before starting long-running jobs on the head node.
7575

7676
Tiger runs version 7.3 of `Springdale Linux <https://puias.math.ias.edu>`_ (a derivative of `RHEL <https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux>`_).
77-
This provides a default toolchain which is appropriate for working with the LSST stack.
78-
You should *not* enable ``devtoolset-3`` (or any other ``devtoolset``) when working with LSST code on this system.
77+
As such, the default toolchain is too old to work with the LSST stack.
78+
You should therefore enable ``devtoolset-6`` before proceeding:
79+
80+
.. prompt:: bash
81+
82+
scl enable devtoolset-6 bash
7983

8084
A regularly-updated LSST “shared stack” is available in :file:`/tigress/HSC/LSST/stack_perseus/` (note that the name of the cluster is embedded in the path).
8185
To get started, try:

0 commit comments

Comments
 (0)