10BC0
Skip to content

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

@Tw1ddle

Description

@Tw1ddle

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0