[Rivet] C++11 plan for Rivet

David Grellscheid david.grellscheid at durham.ac.uk
Fri Sep 2 09:17:09 BST 2016


Hi all,

just got back to this thread after holidays. It's nice to see that my 
arguments get included even when I'm away :)

I agree with Andy that if it's easy to fix the blockers for 4.7 we can 
do that, but shouldn't do a major restructure because of it. The 
compatibility statement would then be a line like "needs >=4.8, 
currently also works with 4.7, but 4.7 is not supported in future".

See you soon,

   David

P.S.: I've summarized my current understanding of what you state here, 
just so it's written up in one place:

> When other programs (e.g. Sherpa) are linking to Rivet, they typically
> include AnalysisHandler.hh, which already uses C++11 features. So
> users compiling those programs with gcc<6 will already have to make
> sure that they export CXXFLAGS=-std=c++11 during that compilation.

Let's assume the following: We're talking about a library (Rivet) 
compiled in 11-mode, and want to know if a user of Rivet can be compiled 
in 98 mode. We also assume that there is an C++-11 aware C++ std library 
available (to provide shared_ptr etc.).

In theory, C++-11 and -98 were intended to be binary compatible.
In practice the answer is very version-dependent:

On Mac with the default compilers, using 98 mode in client code works

Same for Linux/clang

On Linux with gcc...

<= 4.6 : 98 mode is OK, (but not all 11 features supported yet)

== 4.7 : 98 mode is _not_ OK, there's a ABI bug in std::list

4.8/4.9: 98 mode is OK, first full 11 support

5.x    : 98 mode is _not_ OK, compiled code is annotated with
          _cxx11_ in the object file symbol name

6.x    : same as 5, but compiles by default in 11
          (watch out for '-ansi' flags, they switch to 98 mode!)


Therefore, to make things simple in general, clients of Rivet > 2.5 do 
indeed need a detection method like the

AX_CXX_COMPILE_STDCXX([11],[noext],[mandatory])

to switch on the right C++-11 flag.


More information about the Rivet mailing list