Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2000-10-16 13:12:32


From: "Beman Dawes" <beman_at_[hidden]>
> Some problem with __STL_IMPORT_VENDOR_CSTD / BOOST_NO_STDC_NAMESPACE
caused
> several previously working tests to fail. A fix would be appreciated from
> any STLport experts out there.

STLport imports names into std by default starting with version 4. To
determine whether the boost config should do so, you could replaced the
existing code:

# ifndef __STL_IMPORT_VENDOR_CSTD
# define BOOST_NO_STDC_NAMESPACE
# endif

with:

# if __SGI_STL_PORT < 0x400 && !defined(__STL_IMPORT_VENDOR_CSTD)
# define BOOST_NO_STDC_NAMESPACE
# endif

The only trouble this could cause is if someone is using STLport and somehow
told it to _not_ pull names into std. I don't anticipate any problems in
this regard since pulling the names in doesn't cause any harm. In fact,
STLport breaks up the names it can pull into two bunches: those that are
automatically pulled in and those that are only pulled in if
__STL_DO_IMPORT_CSTD_FUNCTIONS is set. The non-automatic names tend to be
intrinsic functions, like memcpy, IIRC, which apparently can cause problems
if pulled into std, although I've have never seen any problems personally.
In any case, this breakdown into two groups should make us feel pretty
confident on our reliance of the STLport version number to tell us whether
names in the automatic group (which is the vast majority) need to be pulled
in by config.hpp.

A separate thread discussed the min/max macro problem that the windows
header causes. STLport "fixes" this problem by making darn sure those
macros never get defined, or if they do that they get undefined. From the
boost perspective, I'd recommend the path of least resistance approach of
documenting something on the order of:

If MS's min/max macros have got you down, use STLport combined with the
following declarations at the global scope to please both standard
conforming code and legacy code that expects the macros:

// Define min and max functions into global namespace since system headers
and canned code rely on them.
using std::min; using std::max;
inline long min(long x, long y) {return std::min(x, y);} // These overloads
prevent ambiguity errors when signed and unsigned integers are compared.
inline long max(long x, long y) {return std::max(x, y);}


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