RE: [eigen] Bye bye "Eigen/CXX11", welcome "EIGEN_CPPYY_ONLY" ?

[ Thread Index | Date Index | More Archives ]

Hi Gael,

I think your suggestion is a good one, but I'm biased by not requiring C++03 support at all, so anything I get "for free" without having to do anything to enable it when using C++1y/z is convenient for me.

> - currently, AFAIK only MSVC enables c++11 features by default, thus limiting the risk when using other compilers

This is not true IIRC for GCC 6 (from
  • The default mode for C++ is now -std=gnu++14 instead of -std=gnu++98.

Best regards

Daniel Vollmer

Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
German Aerospace Center
Institute of Aerodynamics and Flow Technology | Lilienthalplatz 7 | 38108 Braunschweig | Germany

Daniel Vollmer | AS C²A²S²E

Von: Gael Guennebaud [gael.guennebaud@xxxxxxxxx]
Gesendet: Donnerstag, 19. Mai 2016 14:00
An: eigen
Betreff: [eigen] Bye bye "Eigen/CXX11", welcome "EIGEN_CPPYY_ONLY" ?


we have already discussed about the inclusion of C++11 features two years ago [1], and in short, at that time we decided that:
 - C++11 features for which we have a C++03 fallback could be silently enabled when supported by the compiler (e.g., move ctors)
 - but C++11 features without fallback (e.g., "template typedefs", variadic templates) should be provided through dedicated modules placed in the Eigen/CXX11/ folder.

The rationale was to prevent the introduction of dependences to c++11 features in user code without knowing it.

However, two years later, the status of compilers significantly evolved and it also turns out that exposing some C++11 features this way is really cumbersome. Those include for instance math functions, random generators, template typedefs, etc.

**This is currently one of the main blocker to release 3.3**

I would thus rather propose to:
 - by default, silently enable C++11/14/yy features based on compiler detection
 - add the possibility to explicitly bound the c++ version by defining one the following preprocessor macro: EIGEN_CPP03_ONLY, EIGEN_CPP11_ONLY, EIGEN_CPP14_ONLY, etc.
 - explicitly document the required c++ version for each class/functions (as in the well known online C++ documentations)

This new strategy is more consistent with standard practices (e.g., STL, boost), and the EIGEN_CPPYY_ONLY macro is also consistent with our EIGEN_MPL2_ONLY macro. Let me also add that:
- currently, AFAIK only MSVC enables c++11 features by default, thus limiting the risk when using other compilers
- a user might already unknowingly use C++11 features, for instance from the STL, so I don't see anymore why we should be so strict in Eigen.

Of course, we will still strive to remain compatible with C++03 as much as possible, but there are just some features that cannot be done in c++03 (e.g., template typedef), or that would require incredible efforts (e.g. math functions as gamma, lgamma, zeta, etc.).

I hope this proposal is fine to everybody so that we can move forward with 3.3.

This also means that Eigen/CXX11/Tensor could then be moved to a more standard Eigen/Tensor location.


Mail converted by MHonArc 2.6.19+