Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3650: Text Serialization crashes when istream close unexpectedly
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-30 17:27:04
#3650: Text Serialization crashes when istream close unexpectedly
--------------------------------------+-------------------------------------
Reporter: Doug Wallas | Owner: ramey
Type: Feature Requests | Status: closed
Milestone: Boost 1.42.0 | Component: serialization
Version: Boost Development Trunk | Severity: Problem
Resolution: wontfix | Keywords:
--------------------------------------+-------------------------------------
Changes (by ramey):
* status: new => closed
* type: Bugs => Feature Requests
* resolution: => wontfix
Comment:
The reason that I did it the way I did was to permit the user code to
handle the fail case. If I throw an exception after each operation, then
the user can't make code like
{{{
boost::archive::text_iarchive ia(*_stream);
do{
boost::shared_ptr<Message> msg;
ia >> msg; ...
}while(! _stream->eof() && ! _stream->fail() ) {
}}}
But would be obligated to write exception handling code. If you really
want things to operate this way, you can write
{{{
boost::archive::text_iarchive ia(*_stream);
do{
boost::shared_ptr<Message> msg;
ia >> msg; ...
if(_stream->fail())
throw ...
}while(! _stream->eof()) {
}}}
So the current situation leaves more flexibility to the user.
Robert Ramey
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3650#comment:4> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC