|
Boost : |
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-06-26 09:54:54
Beman Dawes <bdawes_at_[hidden]> wrote:
> I'm very curious to hear if people think the newer names are
> an improvement over the TR2 versions.
What about maybe ditching the member functions sysno_value() and
errno_value() entirely and instead having additional free
function overloads:
sysno_t to_sysno(error_code ec);
errno_t to_errno(error_code ec);
And the only way to set an error code is by assignment:
ec = 1234; // sysno
ec = error_code(1234, from_errno);
Some quick notes on the implementation (sorry for the noise if
someone has already mentioned them):
- I notice that you only use strerror() on POSIX platforms. On
some platforms this is not threadsafe, and strerror_r() needs
to be used instead. From memory this function's behaviour can
differ a bit between various platforms as well.
- The ::LocalFree() usage isn't exception safe.
See:
in the implementation of what() for an example.
Cheers,
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk