From: "klapshin"
Is the runtime behaviour correct? Have you been able to reproduce
--- In Boost-Users@yahoogroups.com, Kevlin Henney
wrote: the warning with a smaller example based just on lexical_cast?
I have not tried to run program yet because of much bigger problems with random library -- it simply fails to compile (see my original post).
Reproducing warning with lexical cast is straightforward:
#include
#include <iostream> int main() { std::cout << boost::lexical_cast<int>("7") << std::endl; return 0; } reports the same warning
I:\SW\EXTERNAL\BOOST_1_30_0\boost/lexical_cast.hpp(147) : warning C4800: 'void *' : forcing value to bool 'true' or 'false' (performance warning) I:\SW\EXTERNAL\BOOST_1_30_0\boost/lexical_cast.hpp(146) : while compiling class-template member function 'bool __thiscall boost::detail::lexical_stream
::operator <<(char *const & )' Runtime behaviour of this program is correct. The warning is rather innocent, but annoying. Moreover the warning is abolutely correct -- returning stream from method with bool return type will convert void* to bool. Also it should be rather easy to fix, by explicitely casting it to bool.
This issues has also been reported on the developer list, and I've mentioned the same possible fix there (explicit cast). Regards, Terje