Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-08-03 07:16:18


From: "Victor A. Wagner, Jr." <vawjr_at_[hidden]>

> At Friday 2002/08/02 21:23, you wrote:
]> >
> >Yes. Using the other function is dangerous. It provides a false sense of
> >security by working in all testcases, then throws an exception in the
field
> >when some other process gets in and deletes the file before we get a
> >chance. Precondition checking should usually not be done with exceptions
in
> >the first place, and I think this is a particularly bad use for it.
> >[deleted]
> >This example is much worse, since the problem will almost never show up
> >during testing, and even if it did, there's absolutely no test you can
make
> >to check whether the file will actually exist by the time you try to
delete
> >it.
>
> It means that if the OS won't tell you whether it actually deleted the
> file, the program won't know for sure.
> You might not even be able to tell then (not all OS's report with
> one-to-one correspondence with the truth).

Please give two examples of a program that needs to delete a file and which
cares not only that the file has been deleted, but that its own call to the
OS was the one responsible for the deletion.

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com


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