|
Boost : |
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-11-10 08:12:50
Hi Johan,
Johan Nilsson <r.johan.nilsson_at_[hidden]> wrote:
[...]
> 2) I've implemented similar code previously, but only designed
> for portability with linux and Win32. What I very often use,
> is something corresponding to retrieving errno or calling
> GetLastError (on Win32).
>
> With the current design, it is harder to implement library
> code throwing system_errors (retrieving error codes) as you'll
> need to get the corresponding error code in a
> platform-specific way. Or did I miss something?
I think the intention is that platform specific library
implementations will initialise the error_code in a
platform-specific way. At least, this is what asio does.
> 4) I'm wondering about best practices for how to use the
> error_code class portably while maintaining as much of the
> (native) information as possible. Ideally, it should be
> possible to check for specific error codes portably, while
> having the native descriptions(messages) available for as much
> details as possible. Using native_ecat and compare using
> to_errno?
Asio and its TR2 proposal provide a set of global constants of
type error_code that can be used for portably checking for well
known error codes. See sections 5.2 and 5.3.2.6 in N2054 for
more detail:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2054.pdf
Cheers,
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk