Skip to content

Commit f7d5d5e

Browse files
author
ripley
committed
Update on C++ stanadrds
Add notes on incompatibility of C++ runtime libraries. git-svn-id: https://svn.r-project.org/R/trunk@87628 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 9ecf648 commit f7d5d5e

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

doc/manual/R-exts.texi

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5878,15 +5878,16 @@ of your compiler diagnostics --- this typically means using flags
58785878
@option{-Wstrict-prototypes} for C (on some platforms and compiler
58795879
versions) these are part of @option{-Wall} or @option{-pedantic}).
58805880

5881-
@strong{C++ standards}: From version 3.6.0 (3.6.2 on Windows), @R{}
5882-
defaulted to C++11 where available@footnote{which it is on all known
5883-
platforms, and is required as from @R{} 4.0.0}; from @R{} 4.1.0 to C++14
5884-
and from @R{} 4.3.0 to C++17 (where available). However, in earlier
5885-
versions the default standard was that of the compiler used, often C++98
5886-
or C++14, and the default is likely to change in future. For maximal
5887-
portability a package should either specify a standard (@pxref{Using C++
5888-
code}) or be tested under all of C++11, C++98, C++14 and C++17.
5889-
(Specifying C++14 or later will limit portability.)
5881+
@strong{C++ standards}: From version 4.0.0 @R{} reauired and defaulted
5882+
to C++11; from @R{} 4.1.0 in defaulted to C++14 and from @R{} 4.3.0 to
5883+
C++17 (where available). For maximal portability a package should
5884+
either specify a standard (@pxref{Using C++ code}) or be tested under
5885+
all of C++11, C++14 and C++17.
5886+
5887+
Later C++ standards, notably C++17 remove features deprecated in earlier
5888+
versions. Unfortunately some compilers, notably @command{g++} have
5889+
retained these features so if possible test under another compiler (such
5890+
as that used on macOS).
58905891

58915892
Note that the `TR1' C++ extensions are not part of any of these
58925893
standards and the @code{<tr1/@var{name}>} headers are not supplied by some of
@@ -6451,13 +6452,24 @@ Some additional information for C++ is available at
64516452
@uref{https://journal.r-project.org/archive/2011-2/RJournal_2011-2_Plummer.pdf}
64526453
by @I{Martyn Plummer}.
64536454

6455+
Seversl OSes have or currently do provide multiple C++ runtimes ---
6456+
Solaris did and the LLVM @command{clang} compiler has a native C++
6457+
runtime libreary @code{libc++} but is also used with GCC's
6458+
@code{libstdc++} (by default on Debian/Ubuntu). This makes it unsafe to
6459+
assume that OS libraries with a C++ interface are compatible with the
6460+
C++ compiler specified by @R{}. Many of these system libraries also
6461+
have C interfaces which should be used in preference to their C++
6462+
interface. Otherwise it is essential that a package checks
6463+
compatibility in its @command{configure} script, including that C++ code
6464+
using the library can both be linked @emph{and loaded}.
6465+
64546466

64556467
@node Common symbols
64566468
@subsubsection Common symbols
64576469

64586470
Most OSes (including all those commonly used for @R{}) have the concept
64596471
of `tentative definitions' where global C variables are defined without
6460-
an initializer. Traditionally the linker resolves all tentative
6472+
an initializer. Traditionally the linker resolved all tentative
64616473
definitions of the same variable in different object files to the same
64626474
object, or to a non-tentative definition. However,
64636475
@command{gcc}@tie{}10@footnote{see

0 commit comments

Comments
 (0)