Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2006-08-28 12:11:40


On 8/28/06, Guillaume Melquiond <guillaume.melquiond_at_[hidden]> wrote:
> Le lundi 28 août 2006 à 09:49 -0400, Beman Dawes a écrit :
> > extern error_code throw_on_error;
> >
> > Then only a single signature is required:
> >
> > whatever foo( error_code & ec = throw_on_error );
> >
> > On an error, the implementation of foo throws if ec != &throw_on_error,
> > otherwise it sets ec to the appropriate error_code and returns without
> > throwing.
>
> I often use this idiom and I like it.
>
> You may however encounter problems on systems that have difficulties
> mixing static and shared libraries.

Argh! And a bunch of other words unfit for a public mailing list.

> It may be safer to stick with this
> version of the idiom:
>
> whatever foo(error_code *ec = NULL);

Agreed.

Thanks,

--Beman


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