|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2006-06-29 11:16:45
"Christopher Kohlhoff" <chris_at_[hidden]> wrote in message
news:20060626135454.2789.qmail_at_web32609.mail.mud.yahoo.com...
> 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);
That would simplify the interface, but I'm worried about ease-of-use in
typical use scenarios. Ease-of-use was the motivation for the current
design.
>
> 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:
>
> <http://boost.cvs.sourceforge.net/boost/boost/boost/asio/system_exception.hpp?revision=1.1&view=markup>
>
> in the implementation of what() for an example.
Thanks, I've marked up the source code with you note and will make changes
accordingly.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk