
28 Aug
2006
28 Aug
'06
4:11 p.m.
On 8/28/06, Guillaume Melquiond <guillaume.melquiond@ens-lyon.fr> 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