Examples of errors detected by the V792 diagnostic


V792. The function located to the right of the '|' and '&' operators will be called regardless of the value of the left operand. Consider using '||' and '&&' instead.


Stellarium

V792 The 'toBool' function located to the right of the operator '&' will be called regardless of the value of the left operand. Perhaps, it is better to use '&&'. LandscapeMgr.cpp 782


void LandscapeMgr::onTargetLocationChanged(StelLocation loc)
{
  ....
  if (pl && flagEnvironmentAutoEnabling)
  {
    QSettings* conf = StelApp::getInstance().getSettings();
    setFlagAtmosphere(pl->hasAtmosphere()
                    & conf->value("landscape/flag_atmosphere", true).toBool());
    setFlagFog(pl->hasAtmosphere()
             & conf->value("landscape/flag_fog", true).toBool());
    setFlagLandscape(true);
  }
  ....
}

Similar errors can be found in some other places:

  • V792 The 'toBool' function located to the right of the operator '&' will be called regardless of the value of the left operand. Perhaps, it is better to use '&&'. LandscapeMgr.cpp 783


Bugs Found

Checked Projects
344
Collected Errors
12 970