[Issue 13541] std.windows.syserror.sysErrorString() should be nothrow

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Sep 28 03:17:38 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13541

--- Comment #7 from Marco Leise <Marco.Leise at gmx.de> ---
(In reply to Jakob Ovrum from comment #5)
> As pointed out, it can fail, and it does not recurse with the same value. I
> should have left a comment when I initially wrote it.
> 
> However, I agree with the desire for `nothrow`. I think the practical
> compromise would be to replace the runtime error check for `FormatMessageW`
> with an assert (that also uses assert(false) in the release path), then
> document that the function only accepts valid Windows error codes.

The cleanest would still be to always check the error code from FormatMessage,
even in case of correct input, just because it gives no guarantees about
success in the documentation.

--


More information about the Digitalmars-d-bugs mailing list