Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-03-21 14:44:08


>From: "John Swartzentruber" <johnslists_at_[hidden]>

> I downloaded 1.30.0 and tried to build my project. I got a few errors
> that seem to be in boost, primarily in lexical_cast. Also,
> weak_ptr.hpp uses bad_weak_ptr without including
> boost/detail/shared_count.hpp anywhere. I can fix that by
> including it in my code.
>
> These are the warnings in lexical_cast.hpp. Because I treat
> warnings as errors, these pretty much keep me from using this
> version of boost.

In the reported output there are two warnings, both level 4 warnings, which
are more or less remarks. That's why they are disabled in the lexical_cast
unit tests. They are:

> C:\Program Files\Boost\boost_1_30_0\boost/lexical_cast.hpp(74) : warning
C4512: 'no_lexical_conversion<class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >,long>' : assignment
operator could not be generated

This is due to that it stores a const std::string object, describing the
exception. "no_lexical_cast" is the concrete exception type returned, and it
inherits from "bad_lexical_cast". The reason it stores a string object,
rather than using a static string member (since the information is the same
for all objects of it), is that MSVC 6 couldn't handle that static
initialisation. Ironic, huh? :)

A simple way to fix this is to make the string object non-const, although
there's really no reason for it to be assigned to, as all objects are the
same.

> C:\Program Files\Boost\boost_1_30_0\boost/lexical_cast.hpp(147) : warning
C4800: 'void *' : forcing value to bool 'true' or 'false' (performance
warning)
> C:\Program Files\Boost\boost_1_30_0\boost/lexical_cast.hpp(146) :
while compiling class-template member function 'bool __thiscall

This uses the implicit conversion from pointer to bool, and one could
probably avoid the warning with an explicit cast.

An alternative to the above is:

#pragma warning(disable: 4512 4800)

:)

Regards,

Terje


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