Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-09-30 14:27:33


On Mon, 30 Sep 2002 20:48:33 +0200, Björn Karlsson
<Bjorn.Karlsson_at_[hidden]> wrote:

>I was hoping for a patched "original" version, rather than new material... I
>agree - Jeremy should review the new stuff before it goes in. So, if there's
>a version with a fix, I'd appreciate it, if not, let's wait for Jeremy.

No, sorry. As you may know my "homework" was just to optimize the
implementation of several member functions. While working at the files
I noticed some bugs too and fixed them, but this happened after I had
done other (non fixing) modifications. So I don't have anything which
doesn't contain the new stuff too. Had I noticed the bugs *before*
working at the new things I had certainly sent a patch. BTW, that sort
of #if we are discussing here would better be in the boost config
files. Also, it would be useful if, after the library has been
identified, the config files defined an id (numeric value) to be used
later by client code for those cases where a suitable BOOST_ macro
isn't available (or reasonable). I'm thinking to something like:

#define BOOST_STLPORT_LIB 1
#define BOOST_RW_LIB 2
#define BOOST_DINKUM_LIB 3
....

// in select_stdlib_config
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
// STLPort library
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp"
# define BOOST_LIB BOOST_STLPORT_LIB // <<<<

#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
// Rogue Wave library:
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/roguewave.hpp"
# define BOOST_LIB BOOST_RW_LIB // <<<<

#elif (defined(_YVALS) && !defined(__IBMCPP__)) ||
defined(_CPPLIB_VER)
// Dinkumware Library:
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/dinkumware.hpp"
# define BOOST_LIB BOOST_DINKUM_LIB // <<<<

etc..

This way, in our case we could do:

#if (BOOST_LIB == BOOST_DINKUM_LIB && /*version check... */)
  Block* d = this->m_alloc.allocate(new_nblocks, 0);
#else
  Block* d = this->m_alloc.allocate(new_nblocks);
#endif

In general, this allows to "directly" identify the library from client
code. Currently to do that it isn't enough to check some
library-specific macro like _CPPLIB_VER, you have e.g. to check for
STLport too, usually ending up with long and unreadable #if
conditions. The config files have already done all the work to
correctly identify the library and having a macro that says what is
the library that they detected would allow us to check for it without
introducing new BOOST_xxx macros; in our case without introducing
something like BOOST_ALLOCATOR_ALLOCATE_HAS_ADDITIONAL_ARGUMENT.

I'm saying this just as a simple remark however, because the last time
I suggested a little change to the boost config files it... er...
didn't arise much enthusiasm ;-)

http://aspn.activestate.com/ASPN/Mail/Message/1327922

Genny.


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