Web lists-archives.com

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




Hi Gert !

On Tue, Oct 10, 2017 at 11:31 AM, Gert Wollny <gw.fossdev@xxxxxxxxx> wrote:
> Am Dienstag, den 10.10.2017, 08:45 +0200 schrieb Mathieu Malaterre:
>
> [...]
> 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.
>
> I don't think there is much to gain from it. Whenever there is a change
> in the major version of gcc/g++ many bugs show up and all involved
> really do a great job fixing these. IMHO switching from an older C++
> standard to a newer one is no different. In fact, I think that this
> forced change is an excellent incentive to review older packages.

Right. I have the exact opposite view: why compile a c++ project using
c++11 flags while it was written for c++98...
You also consider that upstream is active and willing to migrate from
c++98 toward c++11 (for example), I had the exact opposite example in
mind.

>> 3. As a fallback, dh should initialize the CXXFLAGS with -std=gnu++98
>
> Why would you pick such an old standard as the default? Also note that
> at least with boost there were instances where the ABI changed
> depending on whether C++11 or higher was enabled or not. - Also for
> that reason I think we should strife for all packages using the same
> C++ standard, and this should be the default of the currently used C++
> compiler. Forcing a lower standard on a package as a maintainer I would
> consider only as a (temporal) workaround to fix RC bugs, and preferable
> only for leaf packages.

I do not see you point clearly. Let me rephrase it then: You would
like to see no explicit -std=c++ in the build logs, so as to guarantee
we always compile a c++ project using whatever default c++ standard is
being used by the current gcc version. Is this a correct rephrasing ?

-M