Boost logo

Boost :

Subject: [boost] [exception] Unreachable returns (was [log] Comments)
From: Daniel James (dnljms_at_[hidden])
Date: 2010-03-16 20:41:42


On 15 March 2010 10:45, Vladimir Prus <ghost_at_[hidden]> wrote:
>
> * I see lots of warnings in slim_string.cpp, e.g:
>
>        ../../../../libs/log/src/slim_string.cpp:237: warning: control reaches end of non-void function
>
> I'd recommend working with maintainer of boost/throw_exception.hpp to add noreturn attributes on
> gcc, and silence the warning in other ways on other compilers.

I think Boost.Exception already does that
(http://www.boost.org/boost/exception/detail/attribute_noreturn.hpp)
but this is something I've been meaning to ask about, as I had to deal
with it for iostreams. Our normal solution is to use
BOOST_UNREACHABLE_RETURN (http://tinyurl.com/yjjdzsh), but that
doesn't work for compilers that don't understand a 'noreturn'
attribute. I hacked together my own version
(http://www.boost.org/boost/iostreams/detail/config/unreachable_return.hpp)
but it's only a short term solution and could break if throw_exception
changes. It would be nice to have a proper solution in
Boost.Exception, or maybe there already is one and I missed it?

Daniel


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