[petsc-dev] C++11, compatibility versus simplicity

Karl Rupp rupp at mcs.anl.gov
Fri Oct 4 03:41:24 CDT 2013


Hey,

> So should we (a) turn it on by default for all compilers that support it
> and give an option to use an earlier standard, (b) turn it on
> automatically as a side-effect of enabling a package that requires it,
> or (c) require that the user configure --with-cxx-dialect=C++11?

I agree with Matt here and opt for (c). Although GCC 4.8.1 finally 
claims to have full support for C++11, it will take years from now until 
this is broadly available on all major platforms including enterprise 
systems. For example, the current CentOS ships with GCC 4.4.7, and this 
is by far not the oldest OS installed out there.

With (a) we might introduce build failures for standard installs for no 
good reason, i.e. try C++11 even if not necessary, and require users to 
manually change it back if something goes wrong. I consider (b) to be a 
reasonable option to go as well for many cases right now, but it has 
some long-term flaws: Imagine similar ABI incompatibilities exist in 
C++14 and C++17, then persuing (b) will result in a hodgepodge of silent 
hops between different versions if a user 'accidentally' enables a 
package which will change the compiler version.

Although I do have some opinions on C++11 and on whether why or why not 
one would want to drop support for a plain C++03 build, I'll refrain 
from an extensive discussion here because we will sooner or later have 
to deal with packages only supporting C++11 anyway. Giving early 
feedback to package authors about build breakages with C++11 even though 
the package works fine with C++03 is the best we can do in order to make 
things as painless as possible.

Best regards,
Karli




More information about the petsc-dev mailing list