4 ms·
It looks like most functions have two variants that differ in how they handle errors. One throws exceptions, and the other returns an error_code. It's nice to
by ridiculous_fish 12y ago
It looks like most functions have two variants that differ in how they handle errors. One throws exceptions, and the other returns an error_code.
It's nice to have non-throwing variant, although the rationale is suspect: it asserts that the non-throwing variants are for "when file system errors are routine," but many large C++ codebases deliberately disable exceptions altogether: Google, Mozilla, LLVM, etc.
Is there precedent for this two-variant approach in other APIs that are part of the C++ standard?
Oh, and this just seems wrong:
> Otherwise, clear() is called on the error_code& argument
Why clear it on success, instead of leaving it alone (like errno)? This makes it harder to sequence calls and then check the error code at the end.
- beached_whale 12y agonew/delete have done this for a while. I wonder if this is because it is the boost filesystem v3 library mostly.