Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 1999-10-09 06:57:48


Beman,

>These techniques can be combined; (1) could be used for the very
commonly used headers such as cstdlib, cstddef, and maybe cstring,
while (2) could be used for the other <c...> headers.

Comments?<

That seems to work OK, even in the presense of duplicate using
declarations, as you say add maybe cstdlib and cstddef to config.hpp, other
boost libraries can deal with other headers on a case by case basis - it
may result in some duplication but this seems to be harmless.

Dave,

>I haven't been following this discussion, but importing names into std
strikes me as a bit regressive, especially when we have our own namespaces
which we can use.<

The point is to make non-conforming C standard libraries behave as if they
were conforming - I guess an alternative would be something like:

#include <cstdlib>

namespace boost{

#ifdef BOOST_NO_STDC_NAMESPACE
using ::size_t;
#else
using std::size_t;
#endif

/* code goes here */

} // namespace boost

The downside is that if the user then adds:

using namespace boost;

they get most of namspace std as well as boost.

On the other hand we could use:

#include <cstdlib>

namespace boost{
namespace undocumented{

#ifdef BOOST_NO_STDC_NAMESPACE
using ::size_t;
#else
using std::size_t;
#endif

/* code goes here */

} // namespace undocumented
using boost::undocumented::some_public_symbol;
} // namespace boost

which allows some degree of implementation hiding even when the code
consists of "all headers", the down side is that it requires more work for
some of the simpler headers. BTW this approach is not mutually exclusive
with Beman's (1) or (2).

Just when I though that this message thread had been put to bed :-)

- John.


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