|
Boost : |
From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2002-08-03 01:39:24
At Friday 2002/08/02 21:23, you wrote:
>From: "Beman Dawes" <bdawes_at_[hidden]>
>
> > Again, the function remove_all() is provided to meet the need for a
> > function which does not throw an exception if the target doesn't exist.
> >
> > It seems to me people are advocating something that is already provided.
>Am
> > I missing something?
>
>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).
>-----------------------------------------------------------
> David Abrahams * Boost Consulting
>dave_at_[hidden] * http://www.boost-consulting.com
Victor A. Wagner Jr. http://rudbek.com
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
"There oughta be a law"
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk