Examples of errors detected by the V730 diagnostic.


V730. Not all members of a class are initialized inside the constructor.


Miranda IM

V730 It is possible that not all members of a class are initialized inside the constructor. Consider inspecting: nLockCount. - ADDITIONAL IN CURRENT utilities.h 130


struct lockable_struct: public void_struct
{
private:
  int nLockCount;
public:
  lockable_struct(): void_struct() { _Lock(); };
  virtual ~lockable_struct() {};

  void _Lock() { nLockCount++; };
  void _Release() { nLockCount--;
                    if (!nLockCount) delete this; };

  int getLockCount() { return nLockCount; };
};

MuseScore

V730 Not all members of a class are initialized inside the constructor. Consider inspecting: _dclickValue1, _dclickValue2. aslider.cpp 30


AbstractSlider::AbstractSlider(QWidget* parent)
   : QWidget(parent), _scaleColor(Qt::darkGray),
     _scaleValueColor(QColor("#2456aa"))
{
  _id         = 0;
  _value      = 0.5;
  _minValue   = 0.0;
  _maxValue   = 1.0;
  _lineStep   = 0.1;
  _pageStep   = 0.2;
  _center     = false;
  _invert     = false;
  _scaleWidth = 4;
  _log        = false;
  _useActualValue = false;
  setFocusPolicy(Qt::StrongFocus);
}

double lineStep() const    { return _lineStep; }
void setLineStep(double v) { _lineStep = v;    }
double pageStep() const    { return _pageStep; }
void setPageStep(double f) { _pageStep = f;    }
double dclickValue1() const      { return _dclickValue1; }
double dclickValue2() const      { return _dclickValue2; }
void setDclickValue1(double val) { _dclickValue1 = val;  }
void setDclickValue2(double val) { _dclickValue2 = val;  }
....

TDLib

V730 CWE-457 Not all members of a class are initialized inside the constructor. Consider inspecting: session_id_. authdata.h 73


class AuthData {
  public:
    AuthData() {
      server_salt_.salt = Random::secure_int64();
      server_salt_.valid_since = -1e10;
      server_salt_.valid_until = -1e10;
    }
    AuthData(const AuthData &) = delete;
    AuthData &operator=(const AuthData &) = delete;
    ....
    uint64 session_id_;
    ....
    uint64 get_session_id() const {
      return session_id_;
    }
    ....
  private:
    bool use_pfs_ = true;
    AuthKey main_auth_key_;
    AuthKey tmp_auth_key_;
    bool server_time_difference_was_updated_ = false;
    double server_time_difference_ = 0;
    ServerSalt server_salt_;
    int64 last_message_id_ = 0;
    int32 seq_no_ = 0;
    std::string header_;
}


Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;
We use cookies for the analysis of events to improve our content and make user interaction more convenient. By continuing the view of our web-pages you accept the terms of using these files. You can find out more about cookie-files and privacy policy or close the notification, by clicking on the button. Learn More →
Do not show