Problems with assignment operator being used inside conditionals (nVidia driver)

The following condition always evaluates to true when using the nVidia drivers:

bool b;
if ((b = true) == false ||
    (b = false) == true)
{
   ...
}

Has anyone else seen this?

Yes. You can rewrite it as this and it will work:

bool b;
if ((b = true) == false)
{

}
else if ((b = false) == true)
{

}

Relic:

Yeah, I noticed. My point is that the driver apparently has problems with conditionals that contain two assignments to the same variable.

I figured that out :wink: Unfortunately the solution then is to not do it this way until it’s fixed.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.