Boost logo

Boost :

Subject: Re: [boost] Proposed SG14 <system_error2> ready for feedback
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2018-03-02 08:27:43


2018-03-01 18:57 GMT+01:00 Niall Douglas via Boost <boost_at_[hidden]>:

> > The github readme at https://github.com/ned14/status-code gives a clear
> > description how I can make use of POSIX and Windows-standard error codes.
>
> It must therefore not be self obvious? Darn. I had thought it very
> simple, basically <system_error> with a few obvious tweaks. Not worth
> much explaining, anyway.
>

Not obvious to me: especially the templetized codes, and two kinds of type
erasure. This part of the design is definitely more complicated than the
original <system_error>. I would expect examples and some rationale.

If you choose to describe <system_error2> as a diff from <system_error>, I
would expect all relevant differences to be mentioned in the docs. For
instance I can see you use `status_code_domain` rather than
`error_category`. This looks like an improvement in clarity. Also, how do
you handle error code names without strings? Do i need to define my own
string_ref?

Similarly, how did you fix the "duplicated globals" problem on Windows?

Also, there is this paragraph:

The relationship between std::error_code and std::error_condition is
confusing to many users reading code based on <system_error>, specifically
when is a comparison between codes *semantic* or *literal*? status_code
makes all comparisons *semantic*, *always*. If you want a literal
comparison, you can do one by hand by comparing domains and values
directly.

I fail to see what you mean by "semantic comparison" and "literal
comparison". Do they mean comparing error_code to error_category and
comparing error_code to error_code respectively?

> > Could we have similar short and clear examples illustrating how one can:
> > 1. Create a custom error_category (or equivalent thing)
> > 2. Use parametrized statuc_code
>
> There is a test custom domain at
> https://github.com/ned14/status-code/blob/master/test/main.cpp#L44.
>
> But how about a mini-tutorial on building a custom code domain whose
> status code wraps any arbitrary thrown C++ exception? It looks like SG14
> and WG21 is going to need one of those in any case.
>

Any information would be useful, but I think it is more basic things that
are insufficiently described.
For now, consider it a feedback on what a casual reader will not understand
about <system_error2> .

Regards,
&rzej;


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