Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-09-26 08:02:59


----- Original Message -----
From: <mda_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, September 26, 2001 1:04 AM
Subject: [boost] Re: policy and rationale for directory and namespace
organization?

> --- In boost_at_y..., Beman Dawes <bdawes_at_a...> wrote:
> > At 06:20 PM 9/24/2001, mda_at_d... wrote:
> > >- boost/rational.hpp is self-contained; within it there is a
> > >namespace detail block (don't know why it isn't an anonymous
> > >namespace).
> >
> > It's good programming practice for header files never to put names
> in the
> > anonymous namespace, to prevent pollution of that namespace.
>
> is there just a single anonymous namespace? what happens with:
> namespace boost {namespace foobar {
> ...
> namespace {
> }
> ...
> }}
> is that innermost namespace the same as a "top-level" anonymous
> one? if so, then i guess i agree with you, though if that is how
> C++ works, it seems like it kind of disables part of the point
> of anonymous namespaces.

No, it's a separate namespace... but a problem with anonymous namespaces is
that they're implicitly visible from all surrounding namespaces. So anything
in boost::<anonymous> looks to the outside world as though it were just in
boost::. Also, all of the names defined there get different link names
depending on what translation-unit they're compiled into. There are any
number of ways this can cause problems at link time. You /really/ don't want
to define anything in an anonymous namespace that will be seen by multiple
translation units, except in the rarest cases.

> does anyone besides boost use "detail"? where did that come from?
> why not "impl" or "priv"?

Because unabbreviated names are better than abbreviated ones.

> are the semantics of "detail" to mean "don't go here" or is it
> more like "advanced users only"?

It means "implementation details", so from a public interface POV, yes, it
means "don't go here".

> > The source files need to be in a different directory hierarchy;
> that's
> > already been hashed out many times in the past.
>
> hmmm, ok. i think boost makes good points about the importance
> of stating rationales; it'd be nice if these determinations were
> stated on the web site with rational (or a url to a past
> mailing list thread, if easier).

Good point.

-Dave


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