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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...