Web lists-archives.com

Re: Mandates explicit -std=c++XY for c++ projects




Ansgar,

On Tue, Oct 10, 2017 at 9:11 AM, Ansgar Burchardt <ansgar@xxxxxxxxxx> wrote:
> Mathieu Malaterre writes:
>> With this mind I'd like to make mandatory the -std=c++XY flags when
>> compiling either a c++ library or a stand-alone c++ program:
>>
>> 1. Either upstream define the explicit -std=c++XY flags by mean of its
>> build system,
>> 2. Or the package maintainers needs to explicit change the CXXFLAGS to
>> pass the appropriate version of the c++ standard. In which case this
>> should be documented in the README.Debian file.
>> 3. As a fallback, dh should initialize the CXXFLAGS with -std=gnu++98
>
> So if the upstream build system adds '-std=c++14' and CXXFLAGS is set to
> '-std=gnu++98', one gets '-std=c++14 -std=gnu++98' and building the
> package no longer works?  That doesn't sound good to me.

My bad, I assumed this would be the opposite, just like the -O3 vs
-O2, so the latest flags would be considered. Let me double check with
a cmake package.

> Why should CXXFLAGS be documented in README.Debian?  (Or in fact
> anywhere outside of d/rules?)  They aren't interesting for users of the
> package.
>
> I also don't think we should default to an ancient C++ standard.  All
> maintained software should hopefully work with C++11 or later by now...

Indeed, that is a key point why I wanted to discuss that. I am fine
changing the point (3) with -std=gnu++14, instead of -std=gnu++98.