Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
Examples of errors detected by the V730…

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

VVVVVV

V730 It is possible that not all members of a class are initialized inside the constructor. Consider inspecting: oldxp, oldyp. Ent.cpp 3


class entclass
{
public:
  entclass();

  void clear();

  bool outside();

public:
  ....
  int oldxp, oldyp;
  ....
};

entclass::entclass()
{
  clear();
}

void entclass::clear()
{
  // Set all values to a default,
  // required for creating a new entity
  active = false;
  invis = false;
  type = 0;
  size = 0;
  tile = 0;
  rule = 0;
  state = 0;
  statedelay = 0;
  life = 0;
  colour = 0;
  para = 0;
  behave = 0;
  animate = 0;

  xp = 0;
  yp = 0;
  ax = 0;
  ay = 0;
  vx = 0;
  vy = 0;
  w = 16;
  h = 16;
  cx = 0;
  cy = 0;
  newxp = 0;
  newyp = 0;

  x1 = 0;
  y1 = 0;
  x2 = 320;
  y2 = 240;

  jumping = false;
  gravity = false;
  onground = 0;
  onroof = 0;
  jumpframe = 0;

  onentity = 0;
  harmful = false;
  onwall = 0;
  onxwall = 0;
  onywall = 0;
  isplatform = false;

  framedelay = 0;
  drawframe = 0;
  walkingframe = 0;
  dir = 0;
  actionframe = 0;
}

DeepSpeech

V730 Not all members of a class are initialized inside the constructor. Consider inspecting: stones_written_. ersatz_progress.cc 14


class ErsatzProgress {
  ....
private:
    void Milestone();

    uint64_t current_, next_, complete_;
    unsigned char stones_written_;
    std::ostream *out_;
};

ErsatzProgress::ErsatzProgress()
  : current_(0)
  , next_(std::numeric_limits<uint64_t>::max())
  , complete_(next_)
  , out_(NULL)
{}

ErsatzProgress::ErsatzProgress(uint64_t complete,
                               std::ostream *to,
                               const std::string &message)
  : current_(0)
  , next_(complete / kWidth)
  , complete_(complete)
  , stones_written_(0)
  , out_(to)
{
  ....
}

There are two constructors, and one of them doesn't initiate all the fields.


close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam