Boost logo

Boost :

Subject: Re: [boost] [config] Macro for null pointer
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-12-02 15:47:19

On December 3, 2012 12:10:38 AM "Jeffrey Lee Hellrung, Jr."
<jeffrey.hellrung_at_[hidden]> wrote:
> 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.

Why would I need the using declaration in my (user's) code if it's
already provided by Boost header? I'm in control of my code, I know
there are no conflicts and I do not disable the global nullptr provided
by Boost. IMHO, you're trying to solve the problem that isn't there.

> 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).

I don't like macros. And for a small tool like nullptr including a
header is just about as much as I would bother doing to get it. If I
have to put BOOST_USING_NULLPTR in every place I intend to use nullptr
I will probably be lazy enough to just continue using NULL.

I would only recommend BOOST_USING_NULLPTR (or explicit conditional
using declaration) to library writers, to avoid conflicts with other libraries.

PS: And Boost does inject things into global scope already. At least
_1, _2... come to mind.

Boost list run by bdawes at, gregod at, cpdaniel at, john at