
"Rob Stewart" <stewart@sig.com> wrote in message news:200505041425.j44EPnrb027885@weezy.balstatdev.susq.com...
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. --Beman