Boost logo

Boost :

Subject: Re: [boost] Current Guidance on Compiler Warnings?
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2018-11-26 14:44:13


On Wed, Nov 21, 2018 at 4:10 PM Rob Stewart via Boost <boost_at_[hidden]>
wrote:

> On November 19, 2018 4:01:45 PM EST, Edward Diener via Boost <
> boost_at_[hidden]> wrote:
> >
> > Warning free is a nice ideal, but the truth is more complicated. Many
> > warnings are not really about possible coding mishaps but about a sort
> > of lint-like standard which compilers now want to enforce and have
> > nothing to do with correct C++ code. Other warnings are simply
> > erroneous, as is prevalent most everywhere in the current default VC++
> > preprocessor. Eliminate even the first class of warnings is often a
> > fool's errand AFAIAC. All one ends up doing is adding completely
> > unnecessary code restrictions to what is perfectly acceptable C++
> > code.
>
> That's a broad claim not generally borne out in my experience.
>

This is a broad claim borne out by my experience.
[ Note - I'm a fan of most warnings. Some of them, though, should DIAF ]

For example, should the following code cause a warning to be emitted?

    auto p = std::make_unique<unsigned char>(0);

At least one popular compiler warns on this code, complaining about a
truncation from int --> unsigned char, and a possible loss of data.

We spent a lot of time and effort in Boost.DateTime with this.
See https://github.com/boostorg/date_time/pull/50 and others.

-- Marshall


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk