From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-05-04 20:16:11
"Rob Stewart" <stewart_at_[hidden]> wrote in message
> status_flag status(path const &, int * error = 0);
> It is simpler from an implementation standpoint, but I don't
> think it is simpler from the caller's perspective. Since the
> argument is defaulted, the compiler will offer no help to ensure
> that you get and inspect the error number.
> Returning a type with the flags and error number together means
> that you always get the error number and can inspect it. Whether
> you use any schemes to ensure that the caller inspects a non-zero
> error number -- such as asserting in the destructor if an
> "inspected" flag isn't set -- is another matter.
That seems like a convincing argument.
We could use std::pair<> or tuple<>, but I'm included to put the two in a
struct with meaningful member names.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk