-
Notifications
You must be signed in to change notification settings - Fork 226
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
Fix warning C4701: "potentially uninitialized local variable used" #1181
base: develop
Are you sure you want to change the base?
Conversation
Cool find. I'll try to maybe find/add a test case that hits the lines? |
Wait a sec, ... According to the covrage report, the lines are being hit. Is there maybe a better fix? Delay declaration of the variables or |
I would need to double check, but I seem to remember fixing this while doing some code-coverage work. Ah, yes it is, see: https://github.com/boostorg/math/blob/develop/include/boost/math/special_functions/detail/bessel_ik.hpp |
I think you can declare n and u at lines 340'and 341? Isn't that the point of the warning? |
They are used not only in the else but later in another if. math/include/boost/math/special_functions/detail/bessel_ik.hpp Lines 338 to 341 in 5a4f8ba
math/include/boost/math/special_functions/detail/bessel_ik.hpp Lines 415 to 417 in 5a4f8ba
Ok, I will try to create a test case... |
I found a test case for that:
Where can I find what result should be for this?
before
the call result was |
I found a way to fail for that case( |
My bad, you are correct that this is NOT fixed in develop, but IS in this branch/PR: #1111 that is still at least somewhat work in progress. I would prefer not to create two competing fixes if possible, as the coverage test branch will be merged fairly soon anyway. Please leave this open and I'll take a look at your test case once I get some time (which will be a couple of weeks). |
Hello.
I tried to use your library (1.86.0) and I faced with an issue. I didn't have the issue with 1.85.0.
I use VS 2022 and I get an error.
As you can see we initialize
n
andu
only in theelse
branch and later we use them inif (reflect)
. We might not get into thisif
if we haven't been in thatelse
but the compiler don't know about it. I tried to fix the issue.