Boost logo

Boost :

From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2006-05-24 08:59:22


On 5/24/06, Gerhard Wesp <gwesp_at_[hidden]> wrote:

> Is it necessary to differentiate between error codes and exceptions? An
> exception *is* an error code for me. IOW, it might make sense to derive
> an error_code class from std::exception.
>
> Assume we have two similar functions f1() and f2() with the same
> possible failure modes. We'd like f1() to throw and f2() not.
>
> The prototypes might look like:
>
> void f1(arguments...) throw(std::exception);
> std::auto_ptr<std::exception> f2(arguments...) throw();

This doesn't work in the context of asio in particular where there are
async functions that return immediately and can only detect/indicate
an error condition at a later time (e.g. by passing it to the Handler
function).

See for example:

http://asio.sourceforge.net/boost-asio-proposal-0.3.6/libs/asio/doc/reference/a00239.html

-- 
Caleb Epstein
caleb dot epstein at gmail dot com

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