|
Boost : |
From: Paul A Bristow (pbristow_at_[hidden])
Date: 2008-04-09 10:02:56
>-----Original Message-----
>From: boost-bounces_at_[hidden]
>[mailto:boost-bounces_at_[hidden]] On Behalf Of Stephan Diederich
>Sent: 08 April 2008 20:53
>To: boost_at_[hidden]
>Subject: [boost] [1.35][lexical_cast][concept check][range]
>Build error andwarnings with MSVC8 on Warning Level 4
>
>As we tried to update to 1.35 today, we found some warnings with MSVC
>on Warning Level 4 in:
>
>lexical_cast:
>There was a return statement after a call to throw_exception which
>causes a unreachable code warning.
>I can see no problem by just removing that return.
>see http://svn.boost.org/trac/boost/ticket/1791
The problem code is:
throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
return Target(); // normally never reached (throw_exception)
Is the problem that the compiler can't be confident that throw_exception won't ever return? (For that matter, can we?)
So would it be better to *suppress the warning* ?
with a push'n'pop around this:
#if (defined _MSC_VER)
# pragma warning( push )
# pragma warning( disable : 4702 ) : unreachable code
#endif
throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
return Target(); // normally never reached (throw_exception)
#if (defined _MSC_VER)
# pragma warning( pop )
#endif
Paul
--- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk