Skip to content

Commit c9c07d1

Browse files
author
ripley
committed
doc updates towards the removal of C++11/14 support
git-svn-id: https://svn.r-project.org/R/trunk@89083 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent f964adb commit c9c07d1

File tree

2 files changed

+34
-74
lines changed

2 files changed

+34
-74
lines changed

config.site

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -307,42 +307,6 @@
307307
## Allow user to override.
308308
## R_LD_LIBRARY_PATH=
309309

310-
## C++11 compiler, optional for use in packages.
311-
## Introduced in R 3.1.0
312-
## The command which runs the C++11 compiler: defaults to $(CXX), but
313-
## empty if that (plus standard) cannot compile the tested C++11 code.
314-
## CXX11=
315-
316-
## The 'standard' for the C++11 compiler, which is invoked as
317-
## $(CXX11) $(CXX11STD) for both compiling and linking DSOs/DLLs.
318-
## '-std=gnu++11' and '-std=gnu++0x' are tried in turn by configure.
319-
## followed by '-std=c++11' and '-std=c++0x'
320-
## CXX11STD=
321-
322-
## Analogues for the C++11 compiler: default to the settings for C++
323-
## CXX11FLAGS=
324-
## CXX11PICFLAGS=
325-
## SHLIB_CXX11LD=
326-
## SHLIB_CXX11LDFLAGS=
327-
328-
## C++14 compiler, optional for use in packages.
329-
## Introduced in R 3.4.0
330-
## The command which runs the C++14 compiler: defaults to $(CXX11), but
331-
## empty if that (plus standard) cannot compile the tested C++14 code.
332-
## CXX14=
333-
334-
## The 'standard' for the C++14 compiler, which is invoked as
335-
## $(CXX14) $(CXX14STD) for both compiling and linking DSOs/DLLs.
336-
## '-std=gnu++14' and '-std=gnu++1y" are tried by configure, also
337-
## '-std=c++14' and '-std=c++1y"
338-
## CXX14STD=
339-
340-
## Analogues for the C++14 compiler: default to the settings for C++11
341-
## CXX14FLAGS=
342-
## CXX14PICFLAGS=
343-
## SHLIB_CXX14LD=
344-
## SHLIB_CXX14LDFLAGS=
345-
346310
## C++17 compiler, optional for use in packages.
347311
## Introduced in R 3.4.0
348312
## The command which runs the C++17 compiler: defaults to $(CXX14), but
@@ -355,7 +319,7 @@
355319
## '-std=c++17' and '-std=c++1z"
356320
## CXX17STD=
357321

358-
## Analogues for the C++17 compiler: default to the settings for C++14
322+
## Analogues for the C++17 compiler.
359323
## CXX17FLAGS=
360324
## CXX17PICFLAGS=
361325
## SHLIB_CXX17LD=

doc/manual/R-exts.texi

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,39 +2950,35 @@ define a module of the same name in multiple source files.
29502950
@node Using C++ code
29512951
@subsection Using C++ code
29522952

2953-
@R{} can be built without a C++ compiler although one is available (but
2954-
not necessarily installed) on all known @R{} platforms.
2955-
standard (`C++11'). A minor update@footnote{Some changes are linked
2956-
from
2957-
@uref{https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations}:
2958-
there were also additional deprecations.} (`C++14') was published in
2959-
December 2014 and was used by default as from @R{} 4.1.0 if supported.
2960-
Further revisions `C++17' (in December 2017), `C++20' (with many new
2961-
features in December 2020) and `C++23' (in October 2024) have been
2962-
published since. The next revision, `C++26', is expected in 2026/7 and
2963-
several compilers already have considerable support for the current
2964-
draft.
2965-
2966-
The support in @R{} for these standards has varied over the years: this
2967-
version of the manual only describes @R{} 4.3.0 and later. For details
2968-
of earlier versions, see the corresponding section in their manuals.
2953+
A new C++ standard has been published every three years since 2011.
2954+
C++26 was feature-frozen in October 2025 and is expected to be published
2955+
in late 2026.
29692956

29702957
The default standard for compiling @R{} packages was changed to C++17 in
2971-
@R{} 4.3.0 if supported, and from @R{} 4.4.0 only a C++17 compiler will
2972-
be selected as the default C++ compiler.
2958+
@R{} 4.4.0: only a C++17 compiler will be selected as the default C++
2959+
compiler. Such a compiler is available (but not necessarily installed)
2960+
on all known @R{} platforms. It is intended that C++20 will become the
2961+
default (`where available') in @R{} 4.6.0: it has been supported on all
2962+
known platforms since at least 2021.
2963+
@c The last was Intel compilers.
2964+
2965+
@R{} has long allowed packages to request a C++ standard: recent
2966+
releases support C++17, C++20, C++23 and C++26 (if a suitable compiler
2967+
is available when @R{} was built): C++11 and C++14 were supported prior
2968+
to @R{} 4.6.0.
29732969

29742970
What standard a C++ compiler aims to support can be hard to determine:
29752971
the value@footnote{Values @code{201103L}, @code{201402L}, @code{201703L}
29762972
and @code{202002L} are most commonly used for C++11, C++14, C++17 and
29772973
C++20 respectively, but some compilers set @code{1L}. For C++23 all that
29782974
can currently be assumed is a value greater than that for C++20: for
2979-
example @command{g++} 12 uses @code{202100L} and @command{clang++} (@I{LLVM}
2980-
15, Apple 14) uses @code{202101L}.} of @code{__cplusplus} may help but
2981-
some compilers use it to denote a standard which is partially supported
2982-
and some the latest standard which is (almost) fully supported. On a
2983-
Unix-alike @command{configure} will try to identify a compiler and flags
2984-
for each of the standards: this relies heavily on the reported values of
2985-
@code{__cplusplus}.
2975+
example @command{g++} 12 uses @code{202100L} and @command{clang++}
2976+
(@I{LLVM} 15, Apple 14) uses @code{202101L}.} of @code{__cplusplus} may
2977+
help but some compilers use it to denote a standard which is partially
2978+
supported and some the latest standard which is (almost) fully
2979+
supported. On a Unix-alike @R{}'s @command{configure} will try to
2980+
identify a compiler and flags for each of the supported standards: this
2981+
relies heavily on the reported values of @code{__cplusplus}.
29862982

29872983
@c Apple clang 14 defaults to C++98 (even 16)
29882984
@c @I{LLVM} clang 14, 15 default to C++14, 16-20 to C++17
@@ -2998,10 +2994,10 @@ C++ standards have deprecated and later removed features (such as
29982994
headers, types and functions). Be aware that some current compilers
29992995
still accept removed features in C++17 mode, such as
30002996
@code{std::unary_function} (deprecated in C++11, removed in C++17) or
3001-
removed in C++20 (such as @code{std::uncaught_exception}). And some
3002-
compilers in use are far from current, notably those used for
3003-
@acronym{CRAN} macOS builds. The Wikipedia pages for the various
3004-
standards list deprecated and removed (and undeprecated) features.
2997+
removed in C++20 (such as @code{std::uncaught_exception}), and most do
2998+
not warn on the use of deprecated features. (And some compilers in use
2999+
are far from current.) The Wikipedia pages for the various standards
3000+
list deprecated and removed (and also undeprecated) features.
30053001

30063002
For maximal portability a package should specify the standard it
30073003
requires for code in its @file{src} directory by including something
@@ -3018,6 +3014,9 @@ If it has a @file{Makevars} file (or @file{Makevars.win} or
30183014
CXX_STD = CXX23
30193015
@end example
30203016

3017+
C++20, C++23 and C++26 (from @R{} 4.5.0) can be specified in an
3018+
analogous way.
3019+
30213020
Code needing C++20 or later features can check for their presence @emph{via}
30223021
`SD-6 feature tests'@footnote{See
30233022
@uref{https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations}
@@ -3026,26 +3025,22 @@ or
30263025

30273026
@c Ubuntu LTS releases now have 10 years of support even if announced
30283027
@c with 8 years.
3029-
@c Ubuntu 14.04LTS (4.8, ESM support extended until 2024-04)
30303028
@c Ubuntu 16.04LTS (5.3, ESM support extended until 2026-04)
30313029
@c Ubuntu 18.04LTS (7.5, on ESM support until 2028-04)
30323030
@c Ubuntu 20.04LTS (9.4, 10.5 available)
30333031
@c Ubuntu 22.04LTS (11.x)
3034-
@c Centos 7 (4.8.5, ESM support until 2024-06)
30353032
@c https://access.redhat.com/solutions/19458
30363033
@c RHEL 7 (4.8, goes to 'extended life cycle' 2024-07 to 2028-06-30)
30373034
@c RHEL 8 (8.x, 9.x available. full support 2024-05 + 8 more years)
30383035
@c RHEL 9 (11.x available, full support 2027-05 + 8 more years)
30393036

3040-
C++20, C++23 and C++26 (from @R{} 4.5.0) can be specified in an
3041-
analogous way.
3042-
3043-
Note that C++17 or later `support' does not mean complete support: use
3037+
Note that `support' for a standard does not mean complete support: use
30443038
feature tests as well as resources such as
30453039
@uref{https://en.cppreference.com/w/cpp/compiler_support.html},
30463040
@uref{https://gcc.gnu.org/projects/cxx-status.html} and
30473041
@uref{https://clang.llvm.org/cxx_status.html} to see if the features you
3048-
want to use are widely implemented.
3042+
want to use are widely implemented. (In particular, C++20 modules were
3043+
not.)
30493044

30503045
Attempts to specify an unknown C++ standard are silently ignored: recent
30513046
versions of @R{} throw an error for C++98 and for known standards for
@@ -3076,7 +3071,8 @@ CXXFLAGS=`"$@{R_HOME@}/bin/R" CMD config CXXFLAGS`
30763071
AC_LANG(C++)
30773072
@end example
30783073
@noindent
3079-
if no standard was specified.
3074+
if no standard was specified. The script needs to check that @code{CXX}
3075+
is not empty.
30803076

30813077
If you want to compile C++ code in a subdirectory, make sure you pass
30823078
down the macros to specify the appropriate compiler, e.g.@: in

0 commit comments

Comments
 (0)