-
-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSVC warnings: narrowing conversion, signed/unsigned mismatch #446
Comments
nickhutchinson
added a commit
to nickhutchinson/doctest
that referenced
this issue
Dec 14, 2020
`EXCEPTION_ILLEGAL_INSTRUCTION` and friends may be either typed as `DWORD` (`unsigned long`) or NTSTATUS (long) depending on whether `ntstatus`.h is included. Add explicit casts to `DWORD` to silence MSVC warnings about narrowing conversions or signed/unsigned mismatches. Fixes doctest#446.
nickhutchinson
added a commit
to nickhutchinson/doctest
that referenced
this issue
Dec 14, 2020
`EXCEPTION_ILLEGAL_INSTRUCTION` and friends may be either typed as `DWORD` (`unsigned long`) or NTSTATUS (long) depending on whether `ntstatus`.h is included. Add explicit casts to `DWORD` to silence MSVC warnings about narrowing conversions or signed/unsigned mismatches. Fixes doctest#446.
nickhutchinson
added a commit
to nickhutchinson/doctest
that referenced
this issue
Dec 14, 2020
`EXCEPTION_ILLEGAL_INSTRUCTION` and friends may be either typed as `DWORD` (`unsigned long`) or `NTSTATUS` (`long`) depending on whether `ntstatus.h` is included. Add explicit casts to `DWORD` to silence MSVC warnings about narrowing conversions or signed/unsigned mismatches. Fixes doctest#446.
onqtam
pushed a commit
that referenced
this issue
Dec 15, 2020
`EXCEPTION_ILLEGAL_INSTRUCTION` and friends may be either typed as `DWORD` (`unsigned long`) or `NTSTATUS` (`long`) depending on whether `ntstatus.h` is included. Add explicit casts to `DWORD` to silence MSVC warnings about narrowing conversions or signed/unsigned mismatches. Fixes #446.
Thanks for reporting! I just merged the PR - closing this now. Will release an official version..."soon"! |
onqtam
pushed a commit
that referenced
this issue
Dec 15, 2020
`EXCEPTION_ILLEGAL_INSTRUCTION` and friends may be either typed as `DWORD` (`unsigned long`) or `NTSTATUS` (`long`) depending on whether `ntstatus.h` is included. Add explicit casts to `DWORD` to silence MSVC warnings about narrowing conversions or signed/unsigned mismatches. Fixes #446.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The following in doctest.cpp can cause MSVC to raise C4245 (signed/unsigned mismatch) and C4838 (narrowing conversion). This is because
EXCEPTION_ILLEGAL_INSTRUCTION
and friends may be defined as either aDWORD
(unsigned long) orNTSTATUS
(signed long) depending on whether ntstatus.h is included.Simplest solution would be to
static_cast
toDWORD
.Steps to reproduce
Extra information
The text was updated successfully, but these errors were encountered: