
"Christopher Kohlhoff" <chris@kohlhoff.com> wrote in message news:20060626135454.2789.qmail@web32609.mail.mud.yahoo.com...
Beman Dawes <bdawes@acm.org> 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:
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