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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Sep 28 02:51:58 PDT 2014


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

Jakob Ovrum <jakobovrum at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakobovrum at gmail.com

--- Comment #5 from Jakob Ovrum <jakobovrum at gmail.com> ---
(In reply to Walter Bright from comment #0)
> 1. sysErrorString()'s argument should ONLY be values returned by Windows
> APIs like GetLastError(), and so this should always succeed. 
> 2. recursively calling sysErrorString() with the SAME value will cause a
> stack overflow crash, not any usable exception.

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.

--


More information about the Digitalmars-d-bugs mailing list