Boost logo

Boost :

Subject: Re: [boost] [exception] ostringstream like
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-08-15 14:26:30


On Sun, Aug 15, 2010 at 5:22 AM, joel falcou <joel.falcou_at_[hidden]> wrote:
> On 15/08/10 14:04, fabien wrote:
>>
>> I would like to propose an "error_info_sstream" class
>
> Well, exception are just here to gather and carry diagnostic info, not full
> fledged error message as it limits applciability (like localization)

This is correct, formatting an error message is always beyond the
scope of the code that throws the exception.

> and may fail to allocate the needed memory
> for the string and stream, thus maskign the initial
> exception with some bad_alloc.

This concern is not valid because the C++ standard permits the runtime
code to run out of memory while trying to throw an exception, which
presumably may result in a std::bad_alloc. Also, in Boost Exception
adding error_info has the postcondition that it has been added,
meaning you may get another exception when you try to add error_info.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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