Subject: [boost] [system][filesystem v3] Question about error_code arguments
From: Beman Dawes (bdawes_at_[hidden])
Date: 2009-10-20 11:15:37
A POSIX sub-group is looking at C++ bindings for POSIX.
They are talking about a filesystem library binding at least loosely
based on Boost.System, Boost.Filesystem, and C++ TR2.
In looking at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2838.html,
"Library Support for Hybrid Error Handling (Rev 2)", they are
concerned about specifying hybrid error handling like this:
void f(error_code& ec=throws());
They would rather see it specified like this:
void f(error_code* ec=0);
One particular concern is that as currently worded, the N2838 proposal
requires throws() return a null reference, which they see as relying
on undefined behavior. I wasn't at the meeting where the LWG asked
that a null reference be mandated; my reading of the standard is that
it is unclear if returning a null reference is or isn't undefined
behavior. Some of the core folks seem to think it is undefined, but
compilers accept it.
Although the reference form is usual for C++, the use of anything
other than the default is limited, and usually in low-level code at
that. Although I could personally live with either form, I'm leaning
slightly toward the pointer form.
Regardless, I'd like to hear Boosters views on the two interfaces
above. Which do you prefer? Why?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk