Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-03-09 17:39:35

Beman Dawes <bdawes_at_[hidden]> writes:

> >This almost goes without saying.
> >
> > create_directory(path p)
> >
> > post: p exists and is a directory
> >
> >If the postcondition cannot be satisfied, create_directory _must_ throw.
> >But if p already exists and is a directory, the postcondition already
> >holds, so we are free to report the "error" via a different mechanism
> >(COM, for example, has a conventional "alternate success code" S_FALSE
> >for such situations).
> We have a similar case with remove(), which is reported by remove()
> returning a bool indicating if it actually removed anything.
> It would be quite consistent for create_directory() to return a bool
> indicating if it actually had to create the directory.

FWIW, I think that's the right approach.

Dave Abrahams
Boost Consulting

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