Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2005-06-20 07:45:16


On Mon, Jun 20, 2005 at 02:24:47PM +0200, Joaqu?n M? L?pez Mu?oz wrote:

>
>
> Martin Wille ha escrito:
>
> > Jonathan Wakely wrote:
> > > On Mon, Jun 20, 2005 at 08:58:12AM +0200, Joaqu?n M? L?pez Mu?oz wrote:
> > [...]
> > >>Google tells us that GCC 2.95 does not provide char_traits<>::eof(),
> > >>hence the problem.
> > >>I can confirm the attached patch solves the issue. OK to commit?
> > >>A better way to macro-detect the offending platform?
> > >
> > >
> > > I think the version check should be for any GCC < 3
> >
> > The problem doesn't exist if stlport is used with gcc 2.95. So, checking
> > for the compiler version seems wrong.
> >
>
> I don't agree here: For instance, in mingw-3_4_2, BOOST_NO_STD_WSTRING
> is defined, yet the workaround is not necessary: checking for the compiler
> version correctly handles this.

For clarity, boost/config/stdlib/sgi.hpp includes the following:

#if (defined(__GNUC__) && (__GNUC__ < 3))
# include <string>
# if defined(__BASTRING__)
# define BOOST_NO_LIMITS
// Note: <boost/limits.hpp> will provide compile-time constants
# undef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# define BOOST_NO_STD_WSTRING
# endif
#endif

That will be triggered if GCC 2.x is used with the default stdlib
(libstdc++-v2) but not if it is used with STLport or libstdc++-v3
(because __BASTRING__ is the include guard from libstdc++-v2's
<string> header)

A more precise check would be to duplicate that test in lexical_cast,
but since it's been done once by the config headers, I think it is
reasonable to use the result of that check (i.e. BOOST_NO_STD_WSTRING
being defined) to infer that we're using libstdc++-v2. Alternatively,
sgi.hpp could additionally define BOOST_GCC_LIBSTDCPP_V2 and that could
be used by lexical_cast.

jon


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