Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-05-03 10:04:08


From: "Peter Dimov" <pdimov_at_[hidden]>
> Beman Dawes wrote:
> > I've completed an analysis of expectations for the exists() and
> > is_xxx() family of functions, and the previously suggested status()
> > and symlink_status() functions.
> >
> > See http://www.esva.net/~beman/filesystem_operations_predicates.htm
> >
> One quick comment about status(). I don't like the fact that the user
> effectively has to read a global variable to obtain the error code. I'd
> prefer something along the lines of
>
> status_flag status( path const & p, int * error = 0 );
>
> or packing the error code in the return value.

I also thought about that. system_error_code() can certainly be
made threadsafe, and all commands can set a thread-specific error
code. But it does mean that it is easy to ignore problems in
calling status() and that one must read the error code before
calling it again.

Perhaps the flags could be accumulated with the error code in a
class that has a safe-bool conversion?

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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