Examples of errors detected by the V592 diagnostic.


V592. The expression was enclosed by parentheses twice: ((expression)). One pair of parentheses is unnecessary or misprint is present.


wxWidgets

V592 The expression was enclosed by parentheses twice: ((expression)). One pair of parentheses is unnecessary or misprint is present. wxscintilla lexau3.cxx 781


static void FoldAU3Doc(....)
{
  ...
  // if a keyword is found on the current line
  // and the line doesn't end with _ (continuation)
  // and we are not inside a commentblock.
  if (szKeywordlen > 0 && (!(chPrev == '_')) &&
      ((!(IsStreamCommentStyle(style)) || foldInComment)) ) {
  ...
}

This is what should have been written here: if (szKeywordlen > 0 && (!(chPrev == '_')) && (!(IsStreamCommentStyle(style) || foldInComment)) ) {.

Similar errors can be found in some other places:

  • V592 The expression was enclosed by parentheses twice: ((expression)). One pair of parentheses is unnecessary or misprint is present. wxscintilla lexpowerpro.cxx 466

Spring Engine

V592 The expression was enclosed by parentheses twice: ((expression)). One pair of parentheses is unnecessary or misprint is present. engineSim weapon.cpp 597


bool CWeapon::AttackUnit(CUnit* newTargetUnit, bool isUserTarget)
{
  if ((!isUserTarget && weaponDef->noAutoTarget)) {
    return false;
  }
  ....
}

TensorFlow

V592 The expression was enclosed by parentheses twice: ((expression)). One pair of parentheses is unnecessary or misprint is present. strcat.cc 43


AlphaNum::AlphaNum(Hex hex) {
  ....
  uint64 value = hex.value;
  uint64 width = hex.spec;
  // We accomplish minimum width by OR'ing in 0x10000
  // to the user's value,
  // where 0x10000 is the smallest hex number
  // that is as wide as the user asked for.
  uint64 mask =
    ((static_cast<uint64>(1) << (width - 1) * 4)) | value;
  ....
}


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++, and C#

goto PVS-Studio;
On our website we use a cookie to collect information of a technical nature.
If you do not agree, please leave the site. Learn More →
Do not show again