Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-04-07 06:04:41


Beman Dawes wrote:
> "Rob Stewart" <stewart_at_[hidden]> wrote in message
> news:200504051942.j35JgJR05410_at_vanzandt.balstatdev.susq.com...
>> I recall that your original notion for the Filesystem library was
>> to enable script-like coding in C++. Such code is less rigorous
>> than normal applications.
>
> I don't buy that. I've seen really seriously flawed data get shipped
> to customers, doing untold harm to the business, because production
> scripts ignored errors.

"Ignore errors" is a broad brush that doesn't apply here.

bool is_directory( p ) throw();

// returns: true if p is a directory, false otherwise or on error

does not ignore errors.

If you try to come up with an example that does untold harm based on the
above is_directory, it won't be easy. That's because every

void do_something_with( p );

will throw if p is mis-classified (and that's exactly as it should be).

That aside, just to show that general principles don't always apply, here's
an example where _not_ ignoring an I/O error does harm to the customer:

open file f
read contents in buffer
close file f // #1

open file g
write buffer into g
close file g

If #1 throws, you've just denied the customer access to the data in f, even
though the data has just been read and may not be recoverable from this
point onwards if the storage has failed physically at #1.


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