Boost logo

Boost :

From: Thomas Witt (witt_at_[hidden])
Date: 2002-08-02 08:14:11

Hash: SHA1

On Thursday 01 August 2002 15:52, David Abrahams wrote:
> From: "Daryle Walker" <darylew_at_[hidden]>
> IMO this response is much too vague to be appropriate for Boost. You should
> be sure about what the standard says on stream state re-setting, and you
> should understand what the standard says about uncaught_exception() to see
> if its use is appropriate here rather than appealing to what "many don't
> think" about its usefulness.

I have to agree with dave here. Though I see the point that support for
std::uncaught_exception is patchy.

That said I do think that io-state saver needs a serious rework regarding
exception safety. From first analysis there are actually three saver types
where the destructor can throw, state, exception and rdbuf. Only one of them
is documented as such. With rdbuf being the most esoteric in my opinion (It
may throws if rdbuf restores a null pointer). On second thought even locale
may throw if registered callbacks throw, but I am not sure about this one.

> In this case it might even make sense just to
> eat any exceptions that occur during destruction with catch(...){}, but you
> need to do the careful analysis to decide what is appropriate. Allowing
> destructors to throw during unwinding is IMO simply unacceptable.

As Daryle mentioned this fix depends on language features that are not widely
available. It works for VC.NET and gcc3 but fails for MWC7.2, gcc2.95.3 and
MSVC6. IIRC that means that for the latter the problem is actually unfixable.

IMHO finding the right semantics isn't easy.

For exception_savers the generated exceptions can be safely suppressed, as the
output function should care about mapping exceptions to stream states(and
subsequent io exceptions).

I don't know what to do about state_savers. Actually I am unsure whether they
are usefull in general.

Rdbuf_savers I don't know either.

- --Thomas

- --
Dipl.-Ing. Thomas Witt
Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover
voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see


Boost list run by bdawes at, gregod at, cpdaniel at, john at