|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2006-07-04 10:06:03
"Christopher Kohlhoff" <chris_at_[hidden]> wrote in message
news:20060628140024.38036.qmail_at_web32601.mail.mud.yahoo.com...
> I'm thinking it might be helpful in the discussion for me to try
> to document in precise terms what asio would need from
> error_code and how it would be used.
>
> What's needed from error_code
> =============================
>
> Testing for equality:
>
> Given
> error_code ec1(value1, category1);
> error_code ec2(value1, category1);
> error_code ec3(value2, category1);
> Then
> ec1 == ec2 evaluates to true
> ec1 == ec3 evaluates to false
Makes sense.
>
> What asio will say
> ==================
>
> (For the sake of brevity I will only discuss a couple of error
> codes, but others will follow the same pattern.)
>
> There will be an error_code object:
>
> namespace boost { namespace asio { namespace error {
> extern error_code connection_reset;
> }}}
Yes, but shouldn't that be: extern const error_code connection_reset;
You don't want users to be able to change connection_reset to some other
value.
> On non-POSIX implementations, the initialisation of
> connection_reset is implementation-defined.
>
> On POSIX implementations, the initialisation of connection_reset
> shall be:
>
> error_code connection_reset(ECONNRESET, from_errno);
>
> such that both of the following expressions shall evaluate to
> true:
>
> connection_reset == error_code(ECONNRESET, from_errno)
> connection_reset.errno_value() == ECONNRESET
Yes.
> ... More examples
I think we are on track. I'll try to post a revised interface later today.
>
> That's all I can think of for now.
Thanks for the examples. That really helps.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk