diff --git a/dynare++/integ/cc/product.cc b/dynare++/integ/cc/product.cc index 2e8b226262f01f0f0d14ad13d23320dd870d2b66..d796a374dcd82898d79e4101e5763d869aef0847 100644 --- a/dynare++/integ/cc/product.cc +++ b/dynare++/integ/cc/product.cc @@ -4,8 +4,8 @@ #include "symmetry.hh" prodpit::prodpit() - : prodq(NULL), level(0), npoints(0), jseq(NULL), - end_flag(true), sig(NULL), p(NULL) + : prodq(NULL), jseq(NULL), + sig(NULL), p(NULL) { } diff --git a/dynare++/integ/cc/product.hh b/dynare++/integ/cc/product.hh index 681341261dde716933fef627df5a887081965cc8..2265ee82634b0f7db3957ceb8a8b684b81efca11 100644 --- a/dynare++/integ/cc/product.hh +++ b/dynare++/integ/cc/product.hh @@ -39,10 +39,10 @@ class prodpit { protected: const ProductQuadrature *prodq; - int level; - int npoints; + int level{0}; + int npoints{0}; IntSequence *jseq; - bool end_flag; + bool end_flag{true}; ParameterSignal *sig; Vector *p; double w; diff --git a/dynare++/integ/cc/smolyak.cc b/dynare++/integ/cc/smolyak.cc index a07bbb2dcdd8d3601bf3812e0038d66346100182..0475cea805804fa3e73f6775279953a4f696fe81 100644 --- a/dynare++/integ/cc/smolyak.cc +++ b/dynare++/integ/cc/smolyak.cc @@ -4,7 +4,7 @@ #include "symmetry.hh" smolpit::smolpit() - : smolq(NULL), isummand(0), jseq(NULL), sig(NULL), p(NULL) + : smolq(NULL), jseq(NULL), sig(NULL), p(NULL) { } diff --git a/dynare++/integ/cc/smolyak.hh b/dynare++/integ/cc/smolyak.hh index d5c6e59a4a12f0a741aeff1059b95cdb3b1ae72e..218d50a0726e005da2587ead2e4f0a01f13d27df 100644 --- a/dynare++/integ/cc/smolyak.hh +++ b/dynare++/integ/cc/smolyak.hh @@ -41,7 +41,7 @@ class smolpit { protected: const SmolyakQuadrature *smolq; - unsigned int isummand; + unsigned int isummand{0}; IntSequence *jseq; ParameterSignal *sig; Vector *p; diff --git a/dynare++/parser/cc/atom_substitutions.hh b/dynare++/parser/cc/atom_substitutions.hh index 9e44ae4e8171a4a7c6895ec149b0ed4756beae89..b46f8855478ebbf80f6244bd5e782c3249fca133 100644 --- a/dynare++/parser/cc/atom_substitutions.hh +++ b/dynare++/parser/cc/atom_substitutions.hh @@ -21,8 +21,8 @@ namespace ogp * about, this is a number of substitutions. */ struct SubstInfo { - int num_substs; - SubstInfo() : num_substs(0) + int num_substs{0}; + SubstInfo() { } }; diff --git a/dynare++/parser/cc/dynamic_atoms.cc b/dynare++/parser/cc/dynamic_atoms.cc index 6634973abaded7c44d5cefe8ef97afed29bc41bf..b604d9cda00f4bf7072688191a189df0ebc2144a 100644 --- a/dynare++/parser/cc/dynamic_atoms.cc +++ b/dynare++/parser/cc/dynamic_atoms.cc @@ -5,9 +5,6 @@ #include "utils/cc/exception.hh" #include "dynamic_atoms.hh" -#include <cstring> -#include <climits> - using namespace ogp; NameStorage::NameStorage(const NameStorage &stor) @@ -136,7 +133,6 @@ Constants::print() const } DynamicAtoms::DynamicAtoms() - : nv(0), minlag(INT_MAX), maxlead(INT_MIN) { } diff --git a/dynare++/parser/cc/dynamic_atoms.hh b/dynare++/parser/cc/dynamic_atoms.hh index e4dd3714c643979cb6a8f60877c24bdc36f4ae86..af9d2979b285ce6ae0ca22a9d2d5fb6b457b871b 100644 --- a/dynare++/parser/cc/dynamic_atoms.hh +++ b/dynare++/parser/cc/dynamic_atoms.hh @@ -12,6 +12,7 @@ #include <set> #include <string> #include <cstring> +#include <climits> namespace ogp { @@ -161,11 +162,11 @@ namespace ogp Tindexmap indices; /** Number of variables. */ - int nv; + int nv{0}; /** Minimum lag, if there is at least one lag, than this is a negative number. */ - int minlag; + int minlag{INT_MAX}; /** Maximum lead, if there is at least one lead, than this is a positive number. */ - int maxlead; + int maxlead{INT_MIN}; public: /** Construct empty DynamicAtoms. */ DynamicAtoms(); diff --git a/dynare++/parser/cc/location.hh b/dynare++/parser/cc/location.hh index 93b51cf1705b6891e486075dcfe46b005970e3cb..e9ed6481451a5c6753eb8a860a1ff1d6c3cbf97f 100644 --- a/dynare++/parser/cc/location.hh +++ b/dynare++/parser/cc/location.hh @@ -23,9 +23,9 @@ namespace ogp struct location_type { - int off; // offset of the token - int ll; // length ot the token - location_type() : off(0), ll(0) + int off{0}; // offset of the token + int ll{0}; // length ot the token + location_type() { } }; diff --git a/dynare++/parser/cc/matrix_parser.cc b/dynare++/parser/cc/matrix_parser.cc index f71f8248ec48f1faa1cdb2a944afb304d6edf251..052af55425073d9f2f06ae27790d524c60a9fc90 100644 --- a/dynare++/parser/cc/matrix_parser.cc +++ b/dynare++/parser/cc/matrix_parser.cc @@ -89,12 +89,12 @@ MatrixParser::end() const } MPIterator::MPIterator(const MatrixParser &mp) - : p(&mp), i(0), c(0), r(mp.find_first_non_empty_row()) + : p(&mp), i(0), r(mp.find_first_non_empty_row()) { } MPIterator::MPIterator(const MatrixParser &mp, const char *dummy) - : p(&mp), i(mp.data.size()), c(0), r(mp.row_lengths.size()) + : p(&mp), i(mp.data.size()), r(mp.row_lengths.size()) { } diff --git a/dynare++/parser/cc/matrix_parser.hh b/dynare++/parser/cc/matrix_parser.hh index e86f57f0e5af737c63782d6118039fa02c8fbf2a..188771252d0ae11c451bb41d837af08755b4ea98 100644 --- a/dynare++/parser/cc/matrix_parser.hh +++ b/dynare++/parser/cc/matrix_parser.hh @@ -31,10 +31,10 @@ namespace ogp /** Number of items in each row. */ vector<int> row_lengths; /** Maximum number of row lengths. */ - int nc; + int nc{0}; public: MatrixParser() - : nc(0) + { } MatrixParser(const MatrixParser &mp) @@ -87,14 +87,14 @@ namespace ogp /** Reference to the matrix parser. */ const MatrixParser *p; /** The index of the pointed item in the matrix parser. */ - unsigned int i; + unsigned int i{0}; /** The column number of the pointed item starting from zero. */ - int c; + int c{0}; /** The row number of the pointed item starting from zero. */ - int r; + int r{0}; public: - MPIterator() : p(NULL), i(0), c(0), r(0) + MPIterator() : p(NULL) { } /** Constructs an iterator pointing to the beginning of the diff --git a/dynare++/parser/cc/tree.hh b/dynare++/parser/cc/tree.hh index 9517d4a9765370f5816fcfdc18bc7753cb28a2c3..075b537e34226d11c1dd69389d00b70c498ae66e 100644 --- a/dynare++/parser/cc/tree.hh +++ b/dynare++/parser/cc/tree.hh @@ -32,11 +32,11 @@ namespace ogp { protected: /** Code of the operation. */ - code_t code; + code_t code{NONE}; /** First operand. If none, then it is -1. */ - int op1; + int op1{-1}; /** Second operand. If none, then it is -1. */ - int op2; + int op2{-1}; public: /** Constructs a binary operation. */ @@ -46,12 +46,12 @@ namespace ogp } /** Constructs a unary operation. */ Operation(code_t cd, int oper1) - : code(cd), op1(oper1), op2(-1) + : code(cd), op1(oper1) { } /** Constructs a nulary operation. */ Operation() - : code(NONE), op1(-1), op2(-1) + { } /** A copy constructor. */ diff --git a/dynare++/src/dynare_model.cc b/dynare++/src/dynare_model.cc index 0d95c91cf5a9365fc4ffcabf50b65856f175abfe..f832b41aef016a03f75f36b32ec4d2ff852c70d7 100644 --- a/dynare++/src/dynare_model.cc +++ b/dynare++/src/dynare_model.cc @@ -26,9 +26,7 @@ ParsedMatrix::ParsedMatrix(const ogp::MatrixParser &mp) } DynareModel::DynareModel() - : atoms(), eqs(atoms), order(-1), - param_vals(0), init_vals(0), vcov_mat(0), - t_plobjective(-1), t_pldiscount(-1), + : atoms(), eqs(atoms), pbuilder(NULL), fbuilder(NULL), atom_substs(NULL), old_atoms(NULL) { diff --git a/dynare++/src/dynare_model.hh b/dynare++/src/dynare_model.hh index 6f8c51fe3300daf90aa888bc567f54ba733bf593..49479ae8ca57085d3452419641b63c1c7c7e2820 100644 --- a/dynare++/src/dynare_model.hh +++ b/dynare++/src/dynare_model.hh @@ -83,22 +83,22 @@ namespace ogdyn /** Parsed model equations. */ ogp::FormulaParser eqs; /** Order of approximation. */ - int order; + int order{-1}; /** A vector of parameters values created by a subclass. It * is stored with natural ordering (outer) of the parameters * given by atoms. */ - Vector *param_vals; + Vector *param_vals{0}; /** A vector of initial values created by a subclass. It is * stored with internal ordering given by atoms. */ - Vector *init_vals; + Vector *init_vals{0}; /** A matrix for vcov. It is created by a subclass. */ - TwoDMatrix *vcov_mat; + TwoDMatrix *vcov_mat{0}; /** Tree index of the planner objective. If there was no * planner objective keyword, the value is set to -1. */ - int t_plobjective; + int t_plobjective{-1}; /** Tree index of the planner discount. If there was no * planner discount keyword, the value is set to -1. */ - int t_pldiscount; + int t_pldiscount{-1}; /** Pointer to PlannerBuilder, which is created only if the * planner's FOC are added to the model. */ PlannerBuilder *pbuilder; diff --git a/dynare++/src/forw_subst_builder.hh b/dynare++/src/forw_subst_builder.hh index 3b920748f477ca1847df819fa8467f0c1dd12caf..a1782f441e1afaddc6cf00d508fd73c567daa63e 100644 --- a/dynare++/src/forw_subst_builder.hh +++ b/dynare++/src/forw_subst_builder.hh @@ -14,15 +14,13 @@ namespace ogdyn * forward substitutions. */ struct ForwSubstInfo { - int num_affected_equations; - int num_subst_terms; - int num_aux_variables; - int num_new_terms; + int num_affected_equations{0}; + int num_subst_terms{0}; + int num_aux_variables{0}; + int num_new_terms{0}; ForwSubstInfo() - : num_affected_equations(0), - num_subst_terms(0), - num_aux_variables(0), - num_new_terms(0) + + { } }; diff --git a/dynare++/src/planner_builder.hh b/dynare++/src/planner_builder.hh index a3406d05a00821c6b3bb4cc9494019db4d7a8acd..ec7da3b983ac62170441bb0458c88ca00e99bc77 100644 --- a/dynare++/src/planner_builder.hh +++ b/dynare++/src/planner_builder.hh @@ -125,13 +125,12 @@ namespace ogdyn * planner's problem. */ struct PlannerInfo { - int num_lagrange_mults; - int num_aux_variables; - int num_new_terms; + int num_lagrange_mults{0}; + int num_aux_variables{0}; + int num_new_terms{0}; PlannerInfo() - : num_lagrange_mults(0), - num_aux_variables(0), - num_new_terms(0) + + { } }; diff --git a/dynare++/sylv/cc/KronVector.hh b/dynare++/sylv/cc/KronVector.hh index b381288368849b5d79e02322983e52ea58139ca9..9ff6f2a3c536926125aa8637e3d97c38709860d0 100644 --- a/dynare++/sylv/cc/KronVector.hh +++ b/dynare++/sylv/cc/KronVector.hh @@ -12,11 +12,11 @@ class ConstKronVector; class KronVector : public Vector { protected: - int m; - int n; - int depth; + int m{0}; + int n{0}; + int depth{0}; public: - KronVector() : Vector((double *) 0, 0), m(0), n(0), depth(0) + KronVector() : Vector((double *) 0, 0) { } KronVector(int mm, int nn, int dp); // new instance diff --git a/dynare++/sylv/cc/QuasiTriangular.hh b/dynare++/sylv/cc/QuasiTriangular.hh index 6794f8e6db4bedd2415d2061d2e18a32c50cb50e..0447f16d5714387d70359d94b016ba8ef22aed6c 100644 --- a/dynare++/sylv/cc/QuasiTriangular.hh +++ b/dynare++/sylv/cc/QuasiTriangular.hh @@ -204,12 +204,12 @@ public: typedef _diag_iter<const Diagonal &, const DiagonalBlock &, list<DiagonalBlock>::const_iterator> const_diag_iter; typedef _diag_iter<Diagonal &, DiagonalBlock &, list<DiagonalBlock>::iterator> diag_iter; private: - int num_all; + int num_all{0}; list<DiagonalBlock> blocks; - int num_real; + int num_real{0}; void copy(const Diagonal &); public: - Diagonal() : num_all(0), num_real(0) + Diagonal() { } Diagonal(double *data, int d_size); diff --git a/dynare++/sylv/cc/SylvMemory.cc b/dynare++/sylv/cc/SylvMemory.cc index 57eee9af17ee6b8e12cb037499abc4405113aac1..f0d4f69e1868bdddb9ec5034c1fe9b696b8f5eba 100644 --- a/dynare++/sylv/cc/SylvMemory.cc +++ b/dynare++/sylv/cc/SylvMemory.cc @@ -21,7 +21,7 @@ SylvMemoryPool memory_pool; SylvMemoryPool::SylvMemoryPool() - : base(0), length(0), allocated(0), stack_mode(false) + { } diff --git a/dynare++/sylv/cc/SylvMemory.hh b/dynare++/sylv/cc/SylvMemory.hh index 73a35dfc7f38e1a6ed07abcfcaaf28d47fc59052..eaac9b613eeff459d6d32b73903b008a855e4db1 100644 --- a/dynare++/sylv/cc/SylvMemory.hh +++ b/dynare++/sylv/cc/SylvMemory.hh @@ -29,10 +29,10 @@ void operator delete[](void *p); class SylvMemoryPool { - char *base; - size_t length; - size_t allocated; - bool stack_mode; + char *base{0}; + size_t length{0}; + size_t allocated{0}; + bool stack_mode{false}; SylvMemoryPool(const SylvMemoryPool &); const SylvMemoryPool &operator=(const SylvMemoryPool &); public: diff --git a/dynare++/sylv/cc/Vector.cc b/dynare++/sylv/cc/Vector.cc index 026553a1c2fd038f04aa1e153e9257f69137a898..47ac7440834bbaf7181d9f056964d572a642aafd 100644 --- a/dynare++/sylv/cc/Vector.cc +++ b/dynare++/sylv/cc/Vector.cc @@ -18,13 +18,13 @@ using namespace std; ZeroPad zero_pad; Vector::Vector(const Vector &v) - : len(v.length()), s(1), data(new double[len]), destroy(true) + : len(v.length()), data(new double[len]), destroy(true) { copy(v.base(), v.skip()); } Vector::Vector(const ConstVector &v) - : len(v.length()), s(1), data(new double[len]), destroy(true) + : len(v.length()), data(new double[len]), destroy(true) { copy(v.base(), v.skip()); } @@ -79,14 +79,14 @@ Vector::copy(const double *d, int inc) } Vector::Vector(Vector &v, int off, int l) - : len(l), s(v.skip()), data(v.base()+off*v.skip()), destroy(false) + : len(l), s(v.skip()), data(v.base()+off*v.skip()) { if (off < 0 || off + length() > v.length()) throw SYLV_MES_EXCEPTION("Subvector not contained in supvector."); } Vector::Vector(const Vector &v, int off, int l) - : len(l), s(1), data(new double[len]), destroy(true) + : len(l), data(new double[len]), destroy(true) { if (off < 0 || off + length() > v.length()) throw SYLV_MES_EXCEPTION("Subvector not contained in supvector."); @@ -94,12 +94,12 @@ Vector::Vector(const Vector &v, int off, int l) } Vector::Vector(GeneralMatrix &m, int col) - : len(m.numRows()), s(1), data(&(m.get(0, col))), destroy(false) + : len(m.numRows()), data(&(m.get(0, col))) { } Vector::Vector(int row, GeneralMatrix &m) - : len(m.numCols()), s(m.getLD()), data(&(m.get(row, 0))), destroy(false) + : len(m.numCols()), s(m.getLD()), data(&(m.get(row, 0))) { } diff --git a/dynare++/sylv/cc/Vector.hh b/dynare++/sylv/cc/Vector.hh index 3afd5d38948aa04a3e3d10d32ac746718e2e133a..30d0ce52e3029d30e66cbdecb70c8d4b94330abb 100644 --- a/dynare++/sylv/cc/Vector.hh +++ b/dynare++/sylv/cc/Vector.hh @@ -17,33 +17,33 @@ class ConstVector; class Vector { protected: - int len; - int s; - double *data; - bool destroy; + int len{0}; + int s{1}; + double *data{0}; + bool destroy{false}; public: - Vector() : len(0), s(1), data(0), destroy(false) + Vector() { } - Vector(int l) : len(l), s(1), data(new double[l]), destroy(true) + Vector(int l) : len(l), data(new double[l]), destroy(true) { } - Vector(Vector &v) : len(v.length()), s(v.skip()), data(v.base()), destroy(false) + Vector(Vector &v) : len(v.length()), s(v.skip()), data(v.base()) { } Vector(const Vector &v); Vector(const ConstVector &v); Vector(const double *d, int l) - : len(l), s(1), data(new double[len]), destroy(true) + : len(l), data(new double[len]), destroy(true) { copy(d, 1); } Vector(double *d, int l) - : len(l), s(1), data(d), destroy(false) + : len(l), data(d) { } Vector(double *d, int skip, int l) - : len(l), s(skip), data(d), destroy(false) + : len(l), s(skip), data(d) { } Vector(Vector &v, int off, int l); diff --git a/dynare++/tl/cc/permutation.cc b/dynare++/tl/cc/permutation.cc index d94cceedd6b266fbec208197081be016f7a3a65b..5beef335ace1804c349efecbc507213263967094 100644 --- a/dynare++/tl/cc/permutation.cc +++ b/dynare++/tl/cc/permutation.cc @@ -70,7 +70,7 @@ Permutation::computeSortingMap(const IntSequence &s) } PermutationSet::PermutationSet() - : order(1), size(1), pers(new const Permutation *[size]) + : pers(new const Permutation *[size]) { pers[0] = new Permutation(1); } diff --git a/dynare++/tl/cc/permutation.hh b/dynare++/tl/cc/permutation.hh index 8a684ffb014b980bb7c627c2a8c941789149fe3e..64d151c32f8edacb55018fa3d8cdd9c6e9fa2d37 100644 --- a/dynare++/tl/cc/permutation.hh +++ b/dynare++/tl/cc/permutation.hh @@ -141,8 +141,8 @@ protected: class PermutationSet { - int order; - int size; + int order{1}; + int size{1}; const Permutation **const pers; public: PermutationSet(); diff --git a/dynare++/tl/cc/sthread.hh b/dynare++/tl/cc/sthread.hh index e449b8b40f39a7acd25e4f72f923ccd01a00319e..085398a796d98ce1f2cf77cf5668e3703956e59a 100644 --- a/dynare++/tl/cc/sthread.hh +++ b/dynare++/tl/cc/sthread.hh @@ -427,16 +427,16 @@ namespace sthread { typedef typename mutex_traits<thread_impl>::_Tmutex _Tmutex; typedef typename cond_traits<thread_impl>::_Tcond _Tcond; - int counter; + int counter{0}; _Tmutex mut; _Tcond cond; - bool changed; + bool changed{true}; public: /* We initialize the counter to 0, and |changed| flag to |true|, since the counter was change from undefined value to 0. */ condition_counter() - : counter(0), changed(true) + { mutex_traits<thread_impl>::init(mut); cond_traits<thread_impl>::init(cond); diff --git a/dynare++/tl/testing/monoms.hh b/dynare++/tl/testing/monoms.hh index 684c9d4f6e54f0d38a9d51a44148f85c91ee460e..3dc285cee08cd55a61cffde9e410e534e949fe4b 100644 --- a/dynare++/tl/testing/monoms.hh +++ b/dynare++/tl/testing/monoms.hh @@ -12,11 +12,11 @@ class IntGenerator { - int maxim; - double probab; + int maxim{5}; + double probab{0.3}; public: IntGenerator() - : maxim(5), probab(0.3) + { } void init(int nf, int ny, int nv, int nw, int nu, int mx, double prob); diff --git a/dynare++/utils/cc/pascal_triangle.hh b/dynare++/utils/cc/pascal_triangle.hh index 66b4bac6b2a03ade3f9867a1a3be7dab55d96500..a2c021fdab9aaaf106b6e01ce9441990490ef8c8 100644 --- a/dynare++/utils/cc/pascal_triangle.hh +++ b/dynare++/utils/cc/pascal_triangle.hh @@ -14,10 +14,10 @@ namespace ogu class PascalRow : public vector<int> { - int k; + int k{1}; public: PascalRow() - : vector<int>(), k(1) + : vector<int>() { push_back(2); }