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. 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_;
}

ANGLE

V730 CWE-457 Not all members of a class are initialized inside the constructor. Consider inspecting: maxAliasedLineWidth. caps.cpp 554


struct Caps
{
  Caps();
  ....
  GLfloat minAliasedLineWidth;
  GLfloat maxAliasedLineWidth;
  ....
};

Caps::Caps()
    : maxElementIndex(0),
      max3DTextureSize(0),
      max2DTextureSize(0),
      maxArrayTextureLayers(0),
      maxLODBias(0),
      maxCubeMapTextureSize(0),
      maxRenderbufferSize(0),
      maxDrawBuffers(0),
      maxColorAttachments(0),
      maxViewportWidth(0),
      maxViewportHeight(0),
      minAliasedPointSize(0),
      maxAliasedPointSize(0),
      minAliasedLineWidth(0),
      // Table 6.29
      maxElementsIndices(0),
      maxElementsVertices(0),
      maxServerWaitTimeout(0),
      // Table 6.31
      maxVertexAttributes(0),
      maxVertexUniformComponents(0),
      maxVertexUniformVectors(0),
      maxVertexUniformBlocks(0),
      maxVertexOutputComponents(0),
      maxVertexTextureImageUnits(0),
      // Table 6.32
      maxFragmentUniformComponents(0),
      maxFragmentUniformVectors(0),
      maxFragmentUniformBlocks(0),
      maxFragmentInputComponents(0),
      maxTextureImageUnits(0),
      minProgramTexelOffset(0),
      maxProgramTexelOffset(0),
      // Table 6.33
      maxUniformBufferBindings(0),
      maxUniformBlockSize(0),
      uniformBufferOffsetAlignment(0),
      maxCombinedUniformBlocks(0),
      maxCombinedVertexUniformComponents(0),
      maxCombinedFragmentUniformComponents(0),
      maxVaryingComponents(0),
      maxVaryingVectors(0),
      maxCombinedTextureImageUnits(0),
      // Table 6.34
      maxTransformFeedbackInterleavedComponents(0),
      maxTransformFeedbackSeparateAttributes(0),
      maxTransformFeedbackSeparateComponents(0),
      // Table 6.35
      maxSamples(0)
{
}

LibrePCB

V730 CWE-457 Not all members of a class are initialized inside the constructor. Consider inspecting: isBad. edge.h 14


template <class T>
class Edge
{
public:
  using VertexType = Vector2<T>;

  Edge(const VertexType &p1, const VertexType &p2, T w=-1) :
    p1(p1), p2(p2), weight(w) {};                             // <=

  Edge(const Edge &e) :
    p1(e.p1), p2(e.p2), weight(e.weight), isBad(false) {};

  Edge() :
    p1(0,0), p2(0,0), weight(0), isBad(false) {}

  VertexType p1;
  VertexType p2;
  T weight=0;

  bool isBad;
};


Bugs Found

Checked Projects
334
Collected Errors
12 668