Jump to content

[RESOLVED] renderer.cpp: Potentially uninitialized local variable used


historic_bruno
 Share

Recommended Posts

I can't access Trac at the moment, so I'll post this here. I get the following two warnings when compiling in VS2010:


13>c:\users\ben\devel\ps\source\renderer\renderer.cpp(1486): warning C4701: potentially uninitialized local variable 'reflectionScissor' used
13>c:\users\ben\devel\ps\source\renderer\renderer.cpp(1493): warning C4701: potentially uninitialized local variable 'refractionScissor' used

Not sure if it causes a problem in practice, but there's no default constructor for SScreenRect, so it needs to be initialized somehow.

Also if I'm understanding the code correctly, it seems like the logic between lines 1484-1504 could be reduced to two cases, since refractionScissor is only used if (m_Options.m_WaterRefraction && !m_Options.m_WaterReflection).

Link to comment
Share on other sites

That's my recent changes. I'll change it, I had done that to avoid problems (I encountered a bug when doing differently, but it ended up being unrelated to this code).

Edit: okay, changed the logic, the warning should not appear anymore. And no, there are 3 cases: both reflection and refraction, reflection only, refraction only. The "both" case I had made a mistake on and so it appeared similar to one of the others.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...