Boost logo

Boost :

From: Guillaume Melquiond (guillaume.melquiond_at_[hidden])
Date: 2006-08-28 11:10:06

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. It may be safer to stick with this
version of the idiom:

whatever foo(error_code *ec = NULL);

Best regards,


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