Examples of errors detected by the V705 diagnostic

V705. It is possible that 'else' block was forgotten or commented out, thus altering the program's operation logics.


K Desktop Environment

V705 It is possible that 'else' block was forgotten or commented out, thus altering the program's operation logics. entrydetailsdialog.cpp 149


void EntryDetails::entryChanged(const KNS3::EntryInternal& entry)
{
  ....
  if(m_entry.previewUrl(EntryInternal::PreviewSmall1).isEmpty()){
    ui->previewBig->setVisible(false);
  } else                                // <=

  if (!m_entry.previewUrl((....)type).isEmpty()) {
    ....
  }
  ....
}

Miranda NG

V705 It is possible that 'else' block was forgotten or commented out, thus altering the program's operation logics. LinkList linklist_fct.cpp 92


int ExtractURI(....)
{
  ....
  while ( msg[i] && !_istspace(msg[i]))
  {
    if ( IsDBCSLeadByte(msg[i] ) && msg[i+1]) i++;
    else                                               // <=

    if ( _istalnum(msg[i]) || msg[i]==_T('/'))
    {
      cpLastAlphaNum = charCount;
      iLastAlphaNum = i;
    }
    charCount++;
    i++;
  }
  ....
}

Linux Kernel

V705 It is possible that 'else' block was forgotten or commented out, thus altering the program's operation logics. grip.c 152


static int grip_xt_read_packet(....)
{
  ....
  if ((u ^ v) & 1) {
    buf = (buf << 1) | (u >> 1);
    t = strobe;
    i++;
  } else

  if ((((u ^ v) & (v ^ w)) >> 1) & ~(u | v | w) & 1) {
  ....
}

FreeBSD Kernel

V705 It is possible that 'else' block was forgotten or commented out, thus altering the program's operation logics. scsi_da.c 3231


static void
dadone(struct cam_periph *periph, union ccb *done_ccb)
{
  ....
  /*
   * If we tried READ CAPACITY(16) and failed,
   * fallback to READ CAPACITY(10).
   */
  if ((state == DA_CCB_PROBE_RC16) &&
    ....
  } else                                                    // <=
  /*
   * Attach to anything that claims to be a
   * direct access or optical disk device,
   * as long as it doesn't return a "Logical
   * unit not supported" (0x25) error.
   */
  if ((have_sense) && (asc != 0x25)                         // <=
    ....
  } else {
    ....
  }
  ....
}

Identical errors can be found in some other places:

  • V705 It is possible that 'else' block was forgotten or commented out, thus altering the program's operation logics. bxe_elink.c 1407


Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;