chriskohlhoff / asio-tr2

C++ TR2 proposal based on Asio
17 stars 5 forks source link

Overspecification? if (ec) throw system_error(ec, __func__); #221

Open jwakely opened 9 years ago

jwakely commented 9 years ago

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0112r0.html#err.report.sync says

error_code ec;
f(a1, a2, ..., aN, ec);
if (ec) throw system_error(ec, __func__);

It's not clear to me that using a different string to __func__ would be conforming.

chriskohlhoff commented 9 years ago

How about something like:

error_code ec;
f(a1, a2, ..., aN, ec);
if (ec) throw system_error(ec, S);

where S is an implementation-defined NTBS [Note: A possible value for S is func. --end note]

Or... can we make it even looser and simply use words to say: if ec is true then the function throws an exception that is catchable as system_error?

jwakely commented 9 years ago

I like the direction, but saying implementation-defined means implementations are required to document what strings are used in which places.

How about:

where S is a NTBS indicating where the exception was thrown [Note: A possible value for S is __func__. --end note]

chriskohlhoff commented 9 years ago

Fixed in b86f0dede9c671e27366d6d032206a4812da520e.