Subject: Re: [boost] [config] Macro for null pointer
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-12-02 15:10:38
On Fri, Nov 30, 2012 at 12:04 AM, Andrey Semashev <andrey.semashev_at_[hidden]
> On Fri, Nov 30, 2012 at 11:19 AM, Jeffrey Lee Hellrung, Jr.
> <jeffrey.hellrung_at_[hidden]> wrote:
> > On Thu, Nov 29, 2012 at 10:59 PM, Andrey Semashev <
> >> wrote:
> >> On Thu, Nov 29, 2012 at 9:51 PM, Jeffrey Lee Hellrung, Jr.
> >> <jeffrey.hellrung_at_[hidden]> wrote:
> >> > On Thu, Nov 29, 2012 at 12:04 AM, Andrey Semashev <
> >> andrey.semashev_at_[hidden]
> >> >> wrote:
> >> >
> >> >> My main point is that
> >> >> nullptr should "just work" (tm) by default.
> >> >>
> >> >
> >> > But, it kinda doesn't "just work" if correct and robust use requires a
> >> > conditional using declaration. And, at that point, what use is the
> >> > boost::nullptr" at global scope anyway, if it's conditional on a
> >> > configuration macro?
> >> The config macro is only used to solve problems, should they arise.
> >> Other than that nullptr will work after simply including the header.
> >> And I'm sure in 99.9% of cases this will be the case.
> > Just to be clear, the conditional using declaration I was referring to is
> > the one you suggested clients should use in their code, whereas you seem
> > be referring to the using declaration in the boost/utility/nullptr.hpp
> > header. Is that right, and is my interpretation of your suggestion
> Yes, I was referring to the global using declaration in
> boost/utility/nullptr.hpp and the BOOST_NO_GLOBAL_NULLPTR config
> I have little concern about BOOST_USING_NULLPTR macro; I would
> probably use conditional using declaration in a public third party
> library anyway (I prefer explicitness of this solution).
Well either way, I reiterate my comment: If we have a conditional
global-scope using declaration, I would imagine we would strongly recommend
that client code likewise include a conditional using declaration (whether
wrapped in a macro or explicitly expressed via #ifndef...#endif) so that
things continue to "just work" whether the global-scope using declaration
is enabled or not.
On the other hand, requiring a user to just have a "BOOST_USING_NULLPTR;"
declaration at the scope they wish to use the nullptr identifier seems
safer (Boost doesn't inject anything into the global scope) and simpler /
more uniform (no need for an additional configuration macro and explanation
for why it's necessary and when one needs to concern oneself with it).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk