Boost logo

Boost :

From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2022-05-28 20:20:46


On Saturday, May 28, 2022, Emil Dotchevski wrote:

> On Sat, May 21, 2022 at 5:59 PM Peter Dimov
> wrote:
> >
> > Compilers apparently are warning on the use of 0 as a null pointer
> > constant, suggesting we use nullptr instead. But compilers don't know
> > that we support C++03 where nullptr isn't a thing.
> >
> > Case in point: https://github.com/boostorg/throw_exception/pull/22
> >
> > ifdef-ing every use of nullptr is unwieldy, so maybe we need
> > BOOST_NULLPTR added to Boost.Config? That would expand to
> > nullptr when it's supported, and 0 otherwise.
>
> Do we have an official Boost policy on "fixing" warnings? E.g. what sort of
> warnings should or should not be fixed?

As far as I know, we don't. We require code to be well-defined and correct.
If the code is correct and well-defined, the thing motivating me to change
correct code to prevent a warning is the convenience for the user.

But only in so far as changing the code does not compromise its performance
or maintainability, etc.

BOOST_NULLPTR being added to Config isn't a mandate to all maintainers to
use it. Just a choice.

If it exists, I would use it. If it exists in Config it means I won't have
to duplicate the following lines in a handful of libraries:

if !defined(BOOST_NO_CXX11_NULLPTR)
#define BOOST_NULLPTR nullptr
#else
#define BOOST_NULLPTR 0
#endif

Unless someone comes up with an idea I find more appealing. (Which hasn't
happened yet in this thread)

Glen


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