Skip to content
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

Warning C4701: potentially uninitialized local variable 'Result' used #782

Closed
Tw1ddle opened this issue Jun 22, 2018 · 1 comment
Closed
Assignees
Milestone

Comments

@Tw1ddle
Copy link

Tw1ddle commented Jun 22, 2018

The following code:

template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, bool, Q> lessThan(vec<L, T, Q> const& x, vec<L, T, Q> const& y)
{
assert(x.length() == y.length());
vec<L, bool, Q> Result;
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] < y[i];
return Result;
}

Produces this warning with MSVC 2013 update 5:

include\glm\detail\func_vector_relational.inl(17): warning C4701: potentially uninitialized local variable 'Result' used

This isn't a bug because the Result vector is always populated in the loop, and there is already an assertion to check the lengths are equal to be sure. I guess it'd be wasteful to initialize the result vector at the beginning, but it would be nice to silence such warnings within glm.

@Groovounet
Copy link
Member

Hi,
This issue should be fixed in master branch for GLM 0.9.9.1 release.
Thanks for reporting,
Christophe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants