diff --git a/dynare++/integ/cc/product.cc b/dynare++/integ/cc/product.cc index d796a374d..c79422419 100644 --- a/dynare++/integ/cc/product.cc +++ b/dynare++/integ/cc/product.cc @@ -4,8 +4,8 @@ #include "symmetry.hh" prodpit::prodpit() - : prodq(NULL), jseq(NULL), - sig(NULL), p(NULL) + : prodq(nullptr), jseq(nullptr), + sig(nullptr), p(nullptr) { } @@ -33,15 +33,15 @@ prodpit::prodpit(const prodpit &ppit) if (ppit.jseq) jseq = new IntSequence(*(ppit.jseq)); else - jseq = NULL; + jseq = nullptr; if (ppit.sig) sig = new ParameterSignal(*(ppit.sig)); else - sig = NULL; + sig = nullptr; if (ppit.p) p = new Vector(*(ppit.p)); else - p = NULL; + p = nullptr; } prodpit::~prodpit() @@ -60,8 +60,8 @@ prodpit::operator==(const prodpit &ppit) const bool ret = true; ret = ret & prodq == ppit.prodq; ret = ret & end_flag == ppit.end_flag; - ret = ret & ((jseq == NULL && ppit.jseq == NULL) - || (jseq != NULL && ppit.jseq != NULL && *jseq == *(ppit.jseq))); + ret = ret & ((jseq == nullptr && ppit.jseq == nullptr) + || (jseq != nullptr && ppit.jseq != nullptr && *jseq == *(ppit.jseq))); return ret; } @@ -82,15 +82,15 @@ prodpit::operator=(const prodpit &ppit) if (ppit.jseq) jseq = new IntSequence(*(ppit.jseq)); else - jseq = NULL; + jseq = nullptr; if (ppit.sig) sig = new ParameterSignal(*(ppit.sig)); else - sig = NULL; + sig = nullptr; if (ppit.p) p = new Vector(*(ppit.p)); else - p = NULL; + p = nullptr; return *this; } diff --git a/dynare++/integ/cc/quadrature.hh b/dynare++/integ/cc/quadrature.hh index d68272c7b..02cf1bc4e 100644 --- a/dynare++/integ/cc/quadrature.hh +++ b/dynare++/integ/cc/quadrature.hh @@ -188,7 +188,7 @@ public: savePoints(const char *fname, int level) const { FILE *fd; - if (NULL == (fd = fopen(fname, "w"))) + if (nullptr == (fd = fopen(fname, "w"))) { // todo: raise fprintf(stderr, "Cannot open file %s for writing.\n", fname); diff --git a/dynare++/integ/cc/quasi_mcarlo.cc b/dynare++/integ/cc/quasi_mcarlo.cc index 8df7be8f8..9c7f9a6f1 100644 --- a/dynare++/integ/cc/quasi_mcarlo.cc +++ b/dynare++/integ/cc/quasi_mcarlo.cc @@ -162,7 +162,7 @@ HaltonSequence::print() const } qmcpit::qmcpit() - : spec(NULL), halton(NULL), sig(NULL) + : spec(nullptr), halton(nullptr), sig(nullptr) { } @@ -173,7 +173,7 @@ qmcpit::qmcpit(const QMCSpecification &s, int n) } qmcpit::qmcpit(const qmcpit &qpit) - : spec(qpit.spec), halton(NULL), sig(NULL) + : spec(qpit.spec), halton(nullptr), sig(nullptr) { if (qpit.halton) halton = new HaltonSequence(*(qpit.halton)); @@ -193,8 +193,8 @@ bool qmcpit::operator==(const qmcpit &qpit) const { return (spec == qpit.spec) - && ((halton == NULL && qpit.halton == NULL) - || (halton != NULL && qpit.halton != NULL && halton->getNum() == qpit.halton->getNum())); + && ((halton == nullptr && qpit.halton == nullptr) + || (halton != nullptr && qpit.halton != nullptr && halton->getNum() == qpit.halton->getNum())); } const qmcpit & @@ -206,7 +206,7 @@ qmcpit::operator=(const qmcpit &qpit) if (qpit.halton) halton = new HaltonSequence(*(qpit.halton)); else - halton = NULL; + halton = nullptr; return *this; } @@ -225,7 +225,7 @@ qmcpit::weight() const } qmcnpit::qmcnpit() - : qmcpit(), pnt(NULL) + : qmcpit(), pnt(nullptr) { } @@ -235,7 +235,7 @@ qmcnpit::qmcnpit(const QMCSpecification &s, int n) } qmcnpit::qmcnpit(const qmcnpit &qpit) - : qmcpit(qpit), pnt(NULL) + : qmcpit(qpit), pnt(nullptr) { if (qpit.pnt) pnt = new Vector(*(qpit.pnt)); @@ -256,7 +256,7 @@ qmcnpit::operator=(const qmcnpit &qpit) if (qpit.pnt) pnt = new Vector(*(qpit.pnt)); else - pnt = NULL; + pnt = nullptr; return *this; } diff --git a/dynare++/integ/cc/smolyak.cc b/dynare++/integ/cc/smolyak.cc index 0475cea80..b2495fefa 100644 --- a/dynare++/integ/cc/smolyak.cc +++ b/dynare++/integ/cc/smolyak.cc @@ -4,7 +4,7 @@ #include "symmetry.hh" smolpit::smolpit() - : smolq(NULL), jseq(NULL), sig(NULL), p(NULL) + : smolq(nullptr), jseq(nullptr), sig(nullptr), p(nullptr) { } @@ -28,15 +28,15 @@ smolpit::smolpit(const smolpit &spit) if (spit.jseq) jseq = new IntSequence(*(spit.jseq)); else - jseq = NULL; + jseq = nullptr; if (spit.sig) sig = new ParameterSignal(*(spit.sig)); else - sig = NULL; + sig = nullptr; if (spit.p) p = new Vector(*(spit.p)); else - p = NULL; + p = nullptr; } smolpit::~smolpit() @@ -55,8 +55,8 @@ smolpit::operator==(const smolpit &spit) const bool ret = true; ret = ret & smolq == spit.smolq; ret = ret & isummand == spit.isummand; - ret = ret & ((jseq == NULL && spit.jseq == NULL) - || (jseq != NULL && spit.jseq != NULL && *jseq == *(spit.jseq))); + ret = ret & ((jseq == nullptr && spit.jseq == nullptr) + || (jseq != nullptr && spit.jseq != nullptr && *jseq == *(spit.jseq))); return ret; } @@ -77,15 +77,15 @@ smolpit::operator=(const smolpit &spit) if (spit.jseq) jseq = new IntSequence(*(spit.jseq)); else - jseq = NULL; + jseq = nullptr; if (spit.sig) sig = new ParameterSignal(*(spit.sig)); else - sig = NULL; + sig = nullptr; if (spit.p) p = new Vector(*(spit.p)); else - p = NULL; + p = nullptr; return *this; } diff --git a/dynare++/integ/src/quadrature-points.cc b/dynare++/integ/src/quadrature-points.cc index 2e2c6e08f..dcdb9f687 100644 --- a/dynare++/integ/src/quadrature-points.cc +++ b/dynare++/integ/src/quadrature-points.cc @@ -29,7 +29,7 @@ private: }; QuadParams::QuadParams(int argc, char **argv) - : outname(NULL), vcovname(NULL), max_level(3), discard_weight(0.0) + : outname(nullptr), vcovname(nullptr), max_level(3), discard_weight(0.0) { if (argc == 1) { @@ -41,10 +41,10 @@ QuadParams::QuadParams(int argc, char **argv) argc--; struct option const opts [] = { - {"max-level", required_argument, NULL, opt_max_level}, - {"discard-weight", required_argument, NULL, opt_discard_weight}, - {"vcov", required_argument, NULL, opt_vcov}, - {NULL, 0, NULL, 0} + {"max-level", required_argument, nullptr, opt_max_level}, + {"discard-weight", required_argument, nullptr, opt_discard_weight}, + {"vcov", required_argument, nullptr, opt_vcov}, + {nullptr, 0, nullptr, 0} }; int ret; @@ -73,13 +73,13 @@ QuadParams::QuadParams(int argc, char **argv) void QuadParams::check_consistency() const { - if (outname == NULL) + if (outname == nullptr) { fprintf(stderr, "Error: output name not set\n"); exit(1); } - if (vcovname == NULL) + if (vcovname == nullptr) { fprintf(stderr, "Error: vcov file name not set\n"); exit(1); @@ -104,7 +104,7 @@ main(int argc, char **argv) // open output file for writing FILE *fout; - if (NULL == (fout = fopen(params.outname, "w"))) + if (nullptr == (fout = fopen(params.outname, "w"))) { fprintf(stderr, "Could not open %s for writing\n", params.outname); exit(1); diff --git a/dynare++/integ/testing/tests.cc b/dynare++/integ/testing/tests.cc index 97a0250a3..85e087633 100644 --- a/dynare++/integ/testing/tests.cc +++ b/dynare++/integ/testing/tests.cc @@ -172,12 +172,12 @@ class WallTimer public: WallTimer(const char *m, bool nl = true) { - strcpy(mes, m); new_line = nl; gettimeofday(&start, NULL); + strcpy(mes, m); new_line = nl; gettimeofday(&start, nullptr); } ~WallTimer() { struct timeval end; - gettimeofday(&end, NULL); + gettimeofday(&end, nullptr); printf("%s%8.4g", mes, end.tv_sec-start.tv_sec + (end.tv_usec-start.tv_usec)*1.0e-6); if (new_line) diff --git a/dynare++/kord/approximation.cc b/dynare++/kord/approximation.cc index eb0a3fdf4..41085d8e6 100644 --- a/dynare++/kord/approximation.cc +++ b/dynare++/kord/approximation.cc @@ -30,7 +30,7 @@ ZAuxContainer::getType(int i, const Symmetry &s) const } Approximation::Approximation(DynamicModel &m, Journal &j, int ns, bool dr_centr, double qz_crit) - : model(m), journal(j), rule_ders(NULL), rule_ders_ss(NULL), fdr(NULL), udr(NULL), + : model(m), journal(j), rule_ders(nullptr), rule_ders_ss(nullptr), fdr(nullptr), udr(nullptr), ypart(model.nstat(), model.npred(), model.nboth(), model.nforw()), mom(UNormalMoments(model.order(), model.getVcov())), nvs(4), steps(ns), dr_centralize(dr_centr), qz_criterium(qz_crit), ss(ypart.ny(), steps+1) @@ -57,7 +57,7 @@ Approximation::~Approximation() const FoldDecisionRule & Approximation::getFoldDecisionRule() const { - KORD_RAISE_IF(fdr == NULL, + KORD_RAISE_IF(fdr == nullptr, "Folded decision rule has not been created in Approximation::getFoldDecisionRule"); return *fdr; } @@ -66,7 +66,7 @@ Approximation::getFoldDecisionRule() const const UnfoldDecisionRule & Approximation::getUnfoldDecisionRule() const { - KORD_RAISE_IF(udr == NULL, + KORD_RAISE_IF(udr == nullptr, "Unfolded decision rule has not been created in Approximation::getUnfoldDecisionRule"); return *udr; } @@ -208,12 +208,12 @@ Approximation::walkStochSteady() if (fdr) { delete fdr; - fdr = NULL; + fdr = nullptr; } if (udr) { delete udr; - udr = NULL; + udr = nullptr; } fdr = new FoldDecisionRule(*rule_ders, ypart, model.nexog(), diff --git a/dynare++/kord/decision_rule.cc b/dynare++/kord/decision_rule.cc index b86b0ef76..c3fd545f6 100644 --- a/dynare++/kord/decision_rule.cc +++ b/dynare++/kord/decision_rule.cc @@ -132,8 +132,8 @@ SimResults::writeMat(const char *base, const char *lname) const { char matfile_name[100]; sprintf(matfile_name, "%s.mat", base); - mat_t *matfd = Mat_Create(matfile_name, NULL); - if (matfd != NULL) + mat_t *matfd = Mat_Create(matfile_name, nullptr); + if (matfd != nullptr) { writeMat(matfd, lname); Mat_Close(matfd); diff --git a/dynare++/kord/decision_rule.hh b/dynare++/kord/decision_rule.hh index b15aeebf6..bc4f996af 100644 --- a/dynare++/kord/decision_rule.hh +++ b/dynare++/kord/decision_rule.hh @@ -534,7 +534,7 @@ template DRFixPoint::DRFixPoint(const _Tg &g, const PartitionY &yp, const Vector &ys, double sigma) : ctraits::Tpol(yp.ny(), yp.nys()), - ysteady(ys), ypart(yp), bigf(NULL), bigfder(NULL) + ysteady(ys), ypart(yp), bigf(nullptr), bigfder(nullptr) { fillTensors(g, sigma); _Tparent yspol(ypart.nstat, ypart.nys(), *this); diff --git a/dynare++/kord/global_check.cc b/dynare++/kord/global_check.cc index 415765f12..6cfb304ba 100644 --- a/dynare++/kord/global_check.cc +++ b/dynare++/kord/global_check.cc @@ -16,13 +16,13 @@ ResidFunction::ResidFunction(const Approximation &app) : VectorFunction(app.getModel().nexog(), app.getModel().numeq()), approx(app), model(app.getModel().clone()), - yplus(NULL), ystar(NULL), u(NULL), hss(NULL) + yplus(nullptr), ystar(nullptr), u(nullptr), hss(nullptr) { } ResidFunction::ResidFunction(const ResidFunction &rf) : VectorFunction(rf), approx(rf.approx), model(rf.model->clone()), - yplus(NULL), ystar(NULL), u(NULL), hss(NULL) + yplus(nullptr), ystar(nullptr), u(nullptr), hss(nullptr) { if (rf.yplus) yplus = new Vector(*(rf.yplus)); diff --git a/dynare++/kord/journal.cc b/dynare++/kord/journal.cc index 395693afb..1c5fc5e08 100644 --- a/dynare++/kord/journal.cc +++ b/dynare++/kord/journal.cc @@ -67,7 +67,7 @@ sysconf(int name) SystemResources::SystemResources() { - gettimeofday(&start, NULL); + gettimeofday(&start, nullptr); } long int @@ -103,7 +103,7 @@ SystemResources::getRUS(double &load_avg, long int &pg_avail, long int &idrss, long int &majflt) { struct timeval now; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); elapsed = now.tv_sec-start.tv_sec + (now.tv_usec-start.tv_usec)*1.0e-6; #if !defined(__MINGW32__) @@ -239,7 +239,7 @@ Journal::printHeader() (*this)<< "\n\nStart time: "; char ts[100]; - time_t curtime = time(NULL); + time_t curtime = time(nullptr); tm loctime; localtime_r(&curtime, &loctime); asctime_r(&loctime, ts); diff --git a/dynare++/kord/korder_stoch.cc b/dynare++/kord/korder_stoch.cc index 768e25f8d..ae0880c76 100644 --- a/dynare++/kord/korder_stoch.cc +++ b/dynare++/kord/korder_stoch.cc @@ -29,7 +29,7 @@ KOrderStoch::KOrderStoch(const PartitionY &yp, int nu, const FGSContainer &hh, Journal &jr) : nvs(4), ypart(yp), journal(jr), _ug(4), _fg(4), _ugs(4), _fgs(4), _uG(4), _fG(4), - _uh(NULL), _fh(&hh), + _uh(nullptr), _fh(&hh), _uZstack(&_uG, ypart.nyss(), &_ug, ypart.ny(), ypart.nys(), nu), _fZstack(&_fG, ypart.nyss(), &_fg, ypart.ny(), ypart.nys(), nu), _uGstack(&_ugs, ypart.nys(), nu), @@ -50,7 +50,7 @@ KOrderStoch::KOrderStoch(const PartitionY &yp, int nu, const UGSContainer &hh, Journal &jr) : nvs(4), ypart(yp), journal(jr), _ug(4), _fg(4), _ugs(4), _fgs(4), _uG(4), _fG(4), - _uh(&hh), _fh(NULL), + _uh(&hh), _fh(nullptr), _uZstack(&_uG, ypart.nyss(), &_ug, ypart.ny(), ypart.nys(), nu), _fZstack(&_fG, ypart.nyss(), &_fg, ypart.ny(), ypart.nys(), nu), _uGstack(&_ugs, ypart.nys(), nu), diff --git a/dynare++/parser/cc/atom_substitutions.cc b/dynare++/parser/cc/atom_substitutions.cc index 64436bf2c..c48c059d9 100644 --- a/dynare++/parser/cc/atom_substitutions.cc +++ b/dynare++/parser/cc/atom_substitutions.cc @@ -35,7 +35,7 @@ AtomSubstitutions::add_substitution(const char *newname, const char *oldname, in // make sure the storage is from the new_atoms newname = new_atoms.get_name_storage().query(newname); oldname = new_atoms.get_name_storage().query(oldname); - if (newname == NULL || oldname == NULL) + if (newname == nullptr || oldname == nullptr) throw ogu::Exception(__FILE__, __LINE__, "Bad newname or oldname in AtomSubstitutions::add_substitution"); @@ -88,7 +88,7 @@ AtomSubstitutions::get_new4old(const char *oldname, int tshift) const if (itt.second == -tshift) return itt.first; } - return NULL; + return nullptr; } void @@ -114,19 +114,19 @@ SAtoms::substituteAllLagsAndLeads(FormulaParser &fp, AtomSubstitutions &as) endovarspan(mlead, mlag); // substitute all endo lagged more than 1 - while (NULL != (name = findEndoWithLeadInInterval(mlag, -2))) + while (nullptr != (name = findEndoWithLeadInInterval(mlag, -2))) makeAuxVariables(name, -1, -2, mlag, fp, as); // substitute all endo leaded more than 1 - while (NULL != (name = findEndoWithLeadInInterval(2, mlead))) + while (nullptr != (name = findEndoWithLeadInInterval(2, mlead))) makeAuxVariables(name, 1, 2, mlead, fp, as); exovarspan(mlead, mlag); // substitute all lagged exo - while (NULL != (name = findExoWithLeadInInterval(mlag, -1))) + while (nullptr != (name = findExoWithLeadInInterval(mlag, -1))) makeAuxVariables(name, -1, -1, mlag, fp, as); // substitute all leaded exo - while (NULL != (name = findExoWithLeadInInterval(1, mlead))) + while (nullptr != (name = findExoWithLeadInInterval(1, mlead))) makeAuxVariables(name, 1, 1, mlead, fp, as); // notify that substitution have been finished @@ -142,16 +142,16 @@ SAtoms::substituteAllLagsAndExo1Leads(FormulaParser &fp, AtomSubstitutions &as) endovarspan(mlead, mlag); // substitute all endo lagged more than 1 - while (NULL != (name = findEndoWithLeadInInterval(mlag, -2))) + while (nullptr != (name = findEndoWithLeadInInterval(mlag, -2))) makeAuxVariables(name, -1, -2, mlag, fp, as); exovarspan(mlead, mlag); // substitute all lagged exo - while (NULL != (name = findExoWithLeadInInterval(mlag, -1))) + while (nullptr != (name = findExoWithLeadInInterval(mlag, -1))) makeAuxVariables(name, -1, -1, mlag, fp, as); // substitute all leaded exo by 1 - while (NULL != (name = findExoWithLeadInInterval(1, 1))) + while (nullptr != (name = findExoWithLeadInInterval(1, 1))) makeAuxVariables(name, 1, 1, 1, fp, as); // notify that substitution have been finished @@ -175,7 +175,7 @@ SAtoms::findNameWithLeadInInterval(const vector &names, } // nothing found - return NULL; + return nullptr; } void @@ -242,7 +242,7 @@ SAtoms::makeAuxVariables(const char *name, int step, int start, int limit_lead, const char *newname; string newname_str; int taux; - if (NULL == (newname = as.get_new4old(name, ll-step))) + if (nullptr == (newname = as.get_new4old(name, ll-step))) { attemptAuxName(name, ll-step, newname_str); newname = newname_str.c_str(); diff --git a/dynare++/parser/cc/csv_parser.cc b/dynare++/parser/cc/csv_parser.cc index 1f0a8737f..5b53f47a2 100644 --- a/dynare++/parser/cc/csv_parser.cc +++ b/dynare++/parser/cc/csv_parser.cc @@ -40,5 +40,5 @@ CSVParser::csv_parse(int length, const char *str) ::csv_parse(); delete [] buffer; csv__destroy_buffer(p); - parsed_string = NULL; + parsed_string = nullptr; } diff --git a/dynare++/parser/cc/csv_parser.hh b/dynare++/parser/cc/csv_parser.hh index f5970f205..31d8402ea 100644 --- a/dynare++/parser/cc/csv_parser.hh +++ b/dynare++/parser/cc/csv_parser.hh @@ -25,7 +25,7 @@ namespace ogp const char *parsed_string; public: CSVParser(CSVParserPeer &p) - : peer(p), row(0), col(0), parsed_string(0) + : peer(p), row(0), col(0), parsed_string(nullptr) { } CSVParser(const CSVParser &csvp) diff --git a/dynare++/parser/cc/dynamic_atoms.cc b/dynare++/parser/cc/dynamic_atoms.cc index b7519d87d..5c11676bd 100644 --- a/dynare++/parser/cc/dynamic_atoms.cc +++ b/dynare++/parser/cc/dynamic_atoms.cc @@ -32,7 +32,7 @@ NameStorage::query(const char *name) const { auto it = name_set.find(name); if (it == name_set.end()) - return NULL; + return nullptr; else return (*it); } diff --git a/dynare++/parser/cc/fine_atoms.cc b/dynare++/parser/cc/fine_atoms.cc index e77160557..0c7ef1cb9 100644 --- a/dynare++/parser/cc/fine_atoms.cc +++ b/dynare++/parser/cc/fine_atoms.cc @@ -76,7 +76,7 @@ AllvarOuterOrdering::AllvarOuterOrdering(const AllvarOuterOrdering &avo, FineAtoms::FineAtoms(const FineAtoms &fa) : DynamicAtoms(fa), params(), endovars(), exovars(), - endo_order(NULL), exo_order(NULL), allvar_order(NULL), + endo_order(nullptr), exo_order(nullptr), allvar_order(nullptr), der_atoms(fa.der_atoms), endo_atoms_map(fa.endo_atoms_map), exo_atoms_map(fa.exo_atoms_map) diff --git a/dynare++/parser/cc/fine_atoms.hh b/dynare++/parser/cc/fine_atoms.hh index 610b6b7c4..e24e584bb 100644 --- a/dynare++/parser/cc/fine_atoms.hh +++ b/dynare++/parser/cc/fine_atoms.hh @@ -229,7 +229,7 @@ namespace ogp vector exo_atoms_map; public: FineAtoms() - : endo_order(NULL), exo_order(NULL), allvar_order(NULL) + : endo_order(nullptr), exo_order(nullptr), allvar_order(nullptr) { } FineAtoms(const FineAtoms &fa); diff --git a/dynare++/parser/cc/matrix_parser.hh b/dynare++/parser/cc/matrix_parser.hh index 88d41b655..19e9b1456 100644 --- a/dynare++/parser/cc/matrix_parser.hh +++ b/dynare++/parser/cc/matrix_parser.hh @@ -91,7 +91,7 @@ namespace ogp int r{0}; public: - MPIterator() : p(NULL) + MPIterator() : p(nullptr) { } /** Constructs an iterator pointing to the beginning of the diff --git a/dynare++/parser/cc/parser_exception.cc b/dynare++/parser/cc/parser_exception.cc index e9512b582..fc4e2519e 100644 --- a/dynare++/parser/cc/parser_exception.cc +++ b/dynare++/parser/cc/parser_exception.cc @@ -48,7 +48,7 @@ ParserException::ParserException(const string &m, const char *dum, int i1, int i } ParserException::ParserException(const ParserException &m, int plus_offset) - : mes(NULL), + : mes(nullptr), aux_i1(-1), aux_i2(-1), aux_i3(-1) { copy(m); @@ -56,7 +56,7 @@ ParserException::ParserException(const ParserException &m, int plus_offset) } ParserException::ParserException(const ParserException &m, const char *dum, int i) - : mes(NULL), + : mes(nullptr), aux_i1(-1), aux_i2(-1), aux_i3(-1) { copy(m); @@ -66,7 +66,7 @@ ParserException::ParserException(const ParserException &m, const char *dum, int } ParserException::ParserException(const ParserException &m, const char *dum, int i1, int i2) - : mes(NULL), + : mes(nullptr), aux_i1(-1), aux_i2(-1), aux_i3(-1) { copy(m); @@ -76,7 +76,7 @@ ParserException::ParserException(const ParserException &m, const char *dum, int } ParserException::ParserException(const ParserException &m, const char *dum, int i1, int i2, int i3) - : mes(NULL), + : mes(nullptr), aux_i1(-1), aux_i2(-1), aux_i3(-1) { copy(m); @@ -86,7 +86,7 @@ ParserException::ParserException(const ParserException &m, const char *dum, int } ParserException::ParserException(const ParserException &e) - : mes(NULL), + : mes(nullptr), aux_i1(-1), aux_i2(-1), aux_i3(-1) { copy(e); diff --git a/dynare++/parser/cc/static_atoms.cc b/dynare++/parser/cc/static_atoms.cc index f742e6af2..5fc58169c 100644 --- a/dynare++/parser/cc/static_atoms.cc +++ b/dynare++/parser/cc/static_atoms.cc @@ -84,7 +84,7 @@ StaticAtoms::inv_index(int t) const { auto it = indices.find(t); if (it == indices.end()) - return NULL; + return nullptr; else return (*it).second; } diff --git a/dynare++/parser/cc/static_fine_atoms.cc b/dynare++/parser/cc/static_fine_atoms.cc index e2c8ee938..54f06f7df 100644 --- a/dynare++/parser/cc/static_fine_atoms.cc +++ b/dynare++/parser/cc/static_fine_atoms.cc @@ -97,7 +97,7 @@ int StaticFineAtoms::check_variable(const char *name) const { const char *ss = varnames.query(name); - if (ss == NULL) + if (ss == nullptr) throw ParserException(string("Variable <")+name+"> not declared.", 0); return index(name); } @@ -208,7 +208,7 @@ void StaticFineAtoms::register_endo(const char *name) { const char *ss = varnames.query(name); - if (ss == NULL) + if (ss == nullptr) throw ogp::ParserException(string("Endogenous variable <") +name+"> not found in storage.", 0); endovars.push_back(ss); @@ -219,7 +219,7 @@ void StaticFineAtoms::register_exo(const char *name) { const char *ss = varnames.query(name); - if (ss == NULL) + if (ss == nullptr) throw ogp::ParserException(string("Exogenous variable <") +name+"> not found in storage.", 0); exovars.push_back(ss); @@ -230,7 +230,7 @@ void StaticFineAtoms::register_param(const char *name) { const char *ss = varnames.query(name); - if (ss == NULL) + if (ss == nullptr) throw ogp::ParserException(string("Parameter <")+name+"> not found in storage.", 0); params.push_back(ss); param_outer_map.insert(Tvarintmap::value_type(ss, params.size()-1)); diff --git a/dynare++/src/dynare3.cc b/dynare++/src/dynare3.cc index b0239709e..7dfc2d239 100644 --- a/dynare++/src/dynare3.cc +++ b/dynare++/src/dynare3.cc @@ -40,8 +40,8 @@ DynareNameList::selectIndices(const vector &ns) const /**************************************************************************************/ Dynare::Dynare(const char *modname, int ord, double sstol, Journal &jr) - : journal(jr), model(NULL), ysteady(NULL), md(1), dnl(NULL), denl(NULL), dsnl(NULL), - fe(NULL), fde(NULL), ss_tol(sstol) + : journal(jr), model(nullptr), ysteady(nullptr), md(1), dnl(nullptr), denl(nullptr), dsnl(nullptr), + fe(nullptr), fde(nullptr), ss_tol(sstol) { // make memory file ogu::MemoryFile mf(modname); @@ -77,8 +77,8 @@ Dynare::Dynare(const char **endo, int num_endo, const char **par, int num_par, const char *equations, int len, int ord, double sstol, Journal &jr) - : journal(jr), model(NULL), ysteady(NULL), md(1), dnl(NULL), denl(NULL), dsnl(NULL), - fe(NULL), fde(NULL), ss_tol(sstol) + : journal(jr), model(nullptr), ysteady(nullptr), md(1), dnl(nullptr), denl(nullptr), dsnl(nullptr), + fe(nullptr), fde(nullptr), ss_tol(sstol) { try { @@ -99,9 +99,9 @@ Dynare::Dynare(const char **endo, int num_endo, } Dynare::Dynare(const Dynare &dynare) - : journal(dynare.journal), model(NULL), - ysteady(NULL), md(dynare.md), - dnl(NULL), denl(NULL), dsnl(NULL), fe(NULL), fde(NULL), + : journal(dynare.journal), model(nullptr), + ysteady(nullptr), md(dynare.md), + dnl(nullptr), denl(nullptr), dsnl(nullptr), fe(nullptr), fde(nullptr), ss_tol(dynare.ss_tol) { model = dynare.model->clone(); diff --git a/dynare++/src/dynare_atoms.cc b/dynare++/src/dynare_atoms.cc index a7e8f9d61..34d3ba355 100644 --- a/dynare++/src/dynare_atoms.cc +++ b/dynare++/src/dynare_atoms.cc @@ -24,7 +24,7 @@ DynareStaticAtoms::register_name(const char *name) int DynareStaticAtoms::check_variable(const char *name) const { - if (0 == varnames.query(name)) + if (nullptr == varnames.query(name)) throw ogp::ParserException(std::string("Unknown name <")+name+">", 0); auto it = vars.find(name); if (it == vars.end()) diff --git a/dynare++/src/dynare_model.cc b/dynare++/src/dynare_model.cc index 84fa6c2a1..ae660fbcc 100644 --- a/dynare++/src/dynare_model.cc +++ b/dynare++/src/dynare_model.cc @@ -27,18 +27,18 @@ ParsedMatrix::ParsedMatrix(const ogp::MatrixParser &mp) DynareModel::DynareModel() : atoms(), eqs(atoms), - pbuilder(NULL), fbuilder(NULL), - atom_substs(NULL), old_atoms(NULL) + pbuilder(nullptr), fbuilder(nullptr), + atom_substs(nullptr), old_atoms(nullptr) { } DynareModel::DynareModel(const DynareModel &dm) : atoms(dm.atoms), eqs(dm.eqs, atoms), order(dm.order), - param_vals(0), init_vals(0), vcov_mat(0), + param_vals(nullptr), init_vals(nullptr), vcov_mat(nullptr), t_plobjective(dm.t_plobjective), t_pldiscount(dm.t_pldiscount), - pbuilder(NULL), fbuilder(NULL), - atom_substs(NULL), old_atoms(NULL) + pbuilder(nullptr), fbuilder(nullptr), + atom_substs(nullptr), old_atoms(nullptr) { if (dm.param_vals) param_vals = new Vector((const Vector &) *(dm.param_vals)); @@ -79,7 +79,7 @@ DynareModel::get_planner_info() const { if (pbuilder) return &(pbuilder->get_info()); - return NULL; + return nullptr; } const ForwSubstInfo * @@ -87,7 +87,7 @@ DynareModel::get_forw_subst_info() const { if (fbuilder) return &(fbuilder->get_info()); - return NULL; + return nullptr; } const ogp::SubstInfo * @@ -95,7 +95,7 @@ DynareModel::get_subst_info() const { if (atom_substs) return &(atom_substs->get_info()); - return NULL; + return nullptr; } void diff --git a/dynare++/src/dynare_model.hh b/dynare++/src/dynare_model.hh index e0b0ed9a9..3d01ebce0 100644 --- a/dynare++/src/dynare_model.hh +++ b/dynare++/src/dynare_model.hh @@ -84,12 +84,12 @@ namespace ogdyn /** 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{0}; + Vector *param_vals{nullptr}; /** A vector of initial values created by a subclass. It is * stored with internal ordering given by atoms. */ - Vector *init_vals{0}; + Vector *init_vals{nullptr}; /** A matrix for vcov. It is created by a subclass. */ - TwoDMatrix *vcov_mat{0}; + TwoDMatrix *vcov_mat{nullptr}; /** Tree index of the planner objective. If there was no * planner objective keyword, the value is set to -1. */ int t_plobjective{-1}; diff --git a/dynare++/src/dynare_params.cc b/dynare++/src/dynare_params.cc index c94f38ca1..297eaae2c 100644 --- a/dynare++/src/dynare_params.cc +++ b/dynare++/src/dynare_params.cc @@ -46,7 +46,7 @@ const char *help_str const char *dyn_basename(const char *str); DynareParams::DynareParams(int argc, char **argv) - : modname(NULL), num_per(100), num_burn(0), num_sim(80), + : modname(nullptr), num_per(100), num_burn(0), num_sim(80), num_rtper(0), num_rtsim(0), num_condper(0), num_condsim(0), num_threads(2), num_steps(0), @@ -71,37 +71,37 @@ DynareParams::DynareParams(int argc, char **argv) argc--; struct option const opts [] = { - {"periods", required_argument, NULL, opt_per}, - {"per", required_argument, NULL, opt_per}, - {"burn", required_argument, NULL, opt_burn}, - {"simulations", required_argument, NULL, opt_sim}, - {"sim", required_argument, NULL, opt_sim}, - {"rtperiods", required_argument, NULL, opt_rtper}, - {"rtper", required_argument, NULL, opt_rtper}, - {"rtsimulations", required_argument, NULL, opt_rtsim}, - {"rtsim", required_argument, NULL, opt_rtsim}, - {"condperiods", required_argument, NULL, opt_condper}, - {"condper", required_argument, NULL, opt_condper}, - {"condsimulations", required_argument, NULL, opt_condsim}, - {"condsim", required_argument, NULL, opt_condsim}, - {"prefix", required_argument, NULL, opt_prefix}, - {"threads", required_argument, NULL, opt_threads}, - {"steps", required_argument, NULL, opt_steps}, - {"seed", required_argument, NULL, opt_seed}, - {"order", required_argument, NULL, opt_order}, - {"ss-tol", required_argument, NULL, opt_ss_tol}, - {"check", required_argument, NULL, opt_check}, - {"check-scale", required_argument, NULL, opt_check_scale}, - {"check-evals", required_argument, NULL, opt_check_evals}, - {"check-num", required_argument, NULL, opt_check_num}, - {"qz-criterium", required_argument, NULL, opt_qz_criterium}, - {"no-irfs", no_argument, NULL, opt_noirfs}, - {"irfs", no_argument, NULL, opt_irfs}, - {"centralize", no_argument, NULL, opt_centralize}, - {"no-centralize", no_argument, NULL, opt_no_centralize}, - {"help", no_argument, NULL, opt_help}, - {"version", no_argument, NULL, opt_version}, - {NULL, 0, NULL, 0} + {"periods", required_argument, nullptr, opt_per}, + {"per", required_argument, nullptr, opt_per}, + {"burn", required_argument, nullptr, opt_burn}, + {"simulations", required_argument, nullptr, opt_sim}, + {"sim", required_argument, nullptr, opt_sim}, + {"rtperiods", required_argument, nullptr, opt_rtper}, + {"rtper", required_argument, nullptr, opt_rtper}, + {"rtsimulations", required_argument, nullptr, opt_rtsim}, + {"rtsim", required_argument, nullptr, opt_rtsim}, + {"condperiods", required_argument, nullptr, opt_condper}, + {"condper", required_argument, nullptr, opt_condper}, + {"condsimulations", required_argument, nullptr, opt_condsim}, + {"condsim", required_argument, nullptr, opt_condsim}, + {"prefix", required_argument, nullptr, opt_prefix}, + {"threads", required_argument, nullptr, opt_threads}, + {"steps", required_argument, nullptr, opt_steps}, + {"seed", required_argument, nullptr, opt_seed}, + {"order", required_argument, nullptr, opt_order}, + {"ss-tol", required_argument, nullptr, opt_ss_tol}, + {"check", required_argument, nullptr, opt_check}, + {"check-scale", required_argument, nullptr, opt_check_scale}, + {"check-evals", required_argument, nullptr, opt_check_evals}, + {"check-num", required_argument, nullptr, opt_check_num}, + {"qz-criterium", required_argument, nullptr, opt_qz_criterium}, + {"no-irfs", no_argument, nullptr, opt_noirfs}, + {"irfs", no_argument, nullptr, opt_irfs}, + {"centralize", no_argument, nullptr, opt_centralize}, + {"no-centralize", no_argument, nullptr, opt_no_centralize}, + {"help", no_argument, nullptr, opt_help}, + {"version", no_argument, nullptr, opt_version}, + {nullptr, 0, nullptr, 0} }; int ret; diff --git a/dynare++/src/main.cc b/dynare++/src/main.cc index 9169a998d..7f5667968 100644 --- a/dynare++/src/main.cc +++ b/dynare++/src/main.cc @@ -54,7 +54,7 @@ main(int argc, char **argv) FILE *mfd; std::string mfile1(params.basename); mfile1 += "_f.m"; - if (NULL == (mfd = fopen(mfile1.c_str(), "w"))) + if (nullptr == (mfd = fopen(mfile1.c_str(), "w"))) { fprintf(stderr, "Couldn't open %s for writing.\n", mfile1.c_str()); exit(1); @@ -65,7 +65,7 @@ main(int argc, char **argv) std::string mfile2(params.basename); mfile2 += "_ff.m"; - if (NULL == (mfd = fopen(mfile2.c_str(), "w"))) + if (nullptr == (mfd = fopen(mfile2.c_str(), "w"))) { fprintf(stderr, "Couldn't open %s for writing.\n", mfile2.c_str()); exit(1); @@ -77,8 +77,8 @@ main(int argc, char **argv) // open mat file std::string matfile(params.basename); matfile += ".mat"; - mat_t *matfd = Mat_Create(matfile.c_str(), NULL); - if (matfd == NULL) + mat_t *matfd = Mat_Create(matfile.c_str(), nullptr); + if (matfd == nullptr) { fprintf(stderr, "Couldn't open %s for writing.\n", matfile.c_str()); exit(1); diff --git a/dynare++/sylv/cc/KronVector.hh b/dynare++/sylv/cc/KronVector.hh index 27b957446..ed5190d16 100644 --- a/dynare++/sylv/cc/KronVector.hh +++ b/dynare++/sylv/cc/KronVector.hh @@ -16,7 +16,7 @@ protected: int n{0}; int depth{0}; public: - KronVector() : Vector((double *) 0, 0) + KronVector() : Vector((double *) nullptr, 0) { } KronVector(int mm, int nn, int dp); // new instance diff --git a/dynare++/sylv/cc/QuasiTriangular.cc b/dynare++/sylv/cc/QuasiTriangular.cc index 5b70818b5..2b0cdeac3 100644 --- a/dynare++/sylv/cc/QuasiTriangular.cc +++ b/dynare++/sylv/cc/QuasiTriangular.cc @@ -87,7 +87,7 @@ Diagonal::Diagonal(double *data, int d_size) else { // it is last column or we have zero below diagonal - DiagonalBlock b(jbar, true, &data[id], &data[id], NULL, NULL); + DiagonalBlock b(jbar, true, &data[id], &data[id], nullptr, nullptr); blocks.push_back(b); } jbar++; @@ -102,8 +102,8 @@ Diagonal::Diagonal(double *data, const Diagonal &d) int d_size = d.getSize(); for (const auto & dit : d) { - double *beta1 = NULL; - double *beta2 = NULL; + double *beta1 = nullptr; + double *beta2 = nullptr; int id = dit.getIndex()*(d_size+1); int idd = id; if (!dit.isReal()) @@ -157,7 +157,7 @@ Diagonal::changeBase(double *p) if (b.isReal()) { DiagonalBlock bnew(jbar, true, &p[base], &p[base], - NULL, NULL); + nullptr, nullptr); it = bnew; } else @@ -243,8 +243,8 @@ Diagonal::checkConsistency(diag_iter it) double *d2 = (*it).alpha.a2; (*it).alpha.a2 = (*it).alpha.a1; (*it).real = true; - (*it).beta1 = 0; - (*it).beta2 = 0; + (*it).beta1 = nullptr; + (*it).beta2 = nullptr; DiagonalBlock b(jbar+1, d2); blocks.insert((++it).iter(), b); num_real += 2; diff --git a/dynare++/sylv/cc/QuasiTriangular.hh b/dynare++/sylv/cc/QuasiTriangular.hh index 87378483f..b66ead9df 100644 --- a/dynare++/sylv/cc/QuasiTriangular.hh +++ b/dynare++/sylv/cc/QuasiTriangular.hh @@ -96,8 +96,8 @@ public: { jbar = jb; real = true; - beta1 = 0; - beta2 = 0; + beta1 = nullptr; + beta2 = nullptr; } DiagonalBlock(const DiagonalBlock &b) { diff --git a/dynare++/sylv/cc/SchurDecomp.cc b/dynare++/sylv/cc/SchurDecomp.cc index 6fe16e1ee..0612e176d 100644 --- a/dynare++/sylv/cc/SchurDecomp.cc +++ b/dynare++/sylv/cc/SchurDecomp.cc @@ -18,9 +18,9 @@ SchurDecomp::SchurDecomp(const SqSylvMatrix &m) lapack_int lwork = 6*rows; auto *const work = new double[lwork]; lapack_int info; - dgees("V", "N", 0, &rows, auxt.base(), &rows, &sdim, + dgees("V", "N", nullptr, &rows, auxt.base(), &rows, &sdim, wr, wi, q->base(), &rows, - work, &lwork, 0, &info); + work, &lwork, nullptr, &info); delete [] work; delete [] wi; delete [] wr; diff --git a/dynare++/sylv/cc/SylvException.cc b/dynare++/sylv/cc/SylvException.cc index 4e2c88e26..bc8ae17a8 100644 --- a/dynare++/sylv/cc/SylvException.cc +++ b/dynare++/sylv/cc/SylvException.cc @@ -16,7 +16,7 @@ SylvException::SylvException(const char *f, int l, const SylvException *s) SylvException::~SylvException() { - if (source != NULL) + if (source != nullptr) { delete source; } @@ -35,7 +35,7 @@ int SylvException::printMessage(char *str, int maxlen) const { int remain = maxlen; - if (source != NULL) + if (source != nullptr) { remain = source->printMessage(str, maxlen); } @@ -53,7 +53,7 @@ SylvException::printMessage(char *str, int maxlen) const SylvExceptionMessage::SylvExceptionMessage(const char *f, int i, const char *mes) - : SylvException(f, i, NULL) + : SylvException(f, i, nullptr) { strcpy(message, mes); } diff --git a/dynare++/sylv/cc/SylvMemory.hh b/dynare++/sylv/cc/SylvMemory.hh index 6300c5da5..7869615dd 100644 --- a/dynare++/sylv/cc/SylvMemory.hh +++ b/dynare++/sylv/cc/SylvMemory.hh @@ -29,7 +29,7 @@ void operator delete[](void *p); class SylvMemoryPool { - char *base{0}; + char *base{nullptr}; size_t length{0}; size_t allocated{0}; bool stack_mode{false}; diff --git a/dynare++/sylv/cc/Vector.hh b/dynare++/sylv/cc/Vector.hh index 4f79ca4a8..162edc543 100644 --- a/dynare++/sylv/cc/Vector.hh +++ b/dynare++/sylv/cc/Vector.hh @@ -19,7 +19,7 @@ class Vector protected: int len{0}; int s{1}; - double *data{0}; + double *data{nullptr}; bool destroy{false}; public: Vector() diff --git a/dynare++/sylv/testing/MMMatrix.cc b/dynare++/sylv/testing/MMMatrix.cc index 099eb3a5a..8a6f52823 100644 --- a/dynare++/sylv/testing/MMMatrix.cc +++ b/dynare++/sylv/testing/MMMatrix.cc @@ -10,7 +10,7 @@ MMMatrixIn::MMMatrixIn(const char *fname) { FILE *fd; - if (NULL == (fd = fopen(fname, "r"))) + if (nullptr == (fd = fopen(fname, "r"))) throw MMException(string("Cannot open file ")+fname+" for reading\n"); char buffer[1000]; @@ -51,7 +51,7 @@ void MMMatrixOut::write(const char *fname, int rows, int cols, const double *data) { FILE *fd; - if (NULL == (fd = fopen(fname, "w"))) + if (nullptr == (fd = fopen(fname, "w"))) throw MMException(string("Cannot open file ")+fname+" for writing\n"); if (0 > fprintf(fd, "%%%%MatrixMarket matrix array real general\n")) diff --git a/dynare++/tl/cc/kron_prod.cc b/dynare++/tl/cc/kron_prod.cc index a60f8fb5d..0eb9a65aa 100644 --- a/dynare++/tl/cc/kron_prod.cc +++ b/dynare++/tl/cc/kron_prod.cc @@ -106,7 +106,7 @@ KronProdAll::setMat(int i, const TwoDMatrix &m) void KronProdAll::setUnit(int i, int n) { - matlist[i] = NULL; + matlist[i] = nullptr; kpd.setRC(i, n, n); } @@ -114,7 +114,7 @@ bool KronProdAll::isUnit() const { int i = 0; - while (i < dimen() && matlist[i] == NULL) + while (i < dimen() && matlist[i] == nullptr) i++; return i == dimen(); } @@ -279,7 +279,7 @@ KronProdAll::mult(const ConstTwoDMatrix &in, TwoDMatrix &out) const } int c; - TwoDMatrix *last = NULL; + TwoDMatrix *last = nullptr; // perform first multiplication AI /* Here we have to construct $A_1\otimes I$, allocate intermediate @@ -338,7 +338,7 @@ KronProdAll::multRows(const IntSequence &irows) const TL_RAISE_IF(irows.size() != dimen(), "Wrong length of row indices in KronProdAll::multRows"); - Vector *last = NULL; + Vector *last = nullptr; ConstVector *row; vector to_delete; for (int i = 0; i < dimen(); i++) diff --git a/dynare++/tl/cc/permutation.cc b/dynare++/tl/cc/permutation.cc index 5beef335a..b5d7a5efb 100644 --- a/dynare++/tl/cc/permutation.cc +++ b/dynare++/tl/cc/permutation.cc @@ -80,7 +80,7 @@ PermutationSet::PermutationSet(const PermutationSet &sp, int n) pers(new const Permutation *[size]) { for (int i = 0; i < size; i++) - pers[i] = NULL; + pers[i] = nullptr; TL_RAISE_IF(n != sp.order+1, "Wrong new order in PermutationSet constructor"); diff --git a/dynare++/tl/cc/sthread.cc b/dynare++/tl/cc/sthread.cc index b867c5018..b74221928 100644 --- a/dynare++/tl/cc/sthread.cc +++ b/dynare++/tl/cc/sthread.cc @@ -22,7 +22,7 @@ namespace sthread void thread_traits::run(_Ctype *c) { - pthread_create(&(c->getThreadIden()), NULL, posix_thread_function, (void *) c); + pthread_create(&(c->getThreadIden()), nullptr, posix_thread_function, (void *) c); } void *posix_detach_thread_function(void *c); @@ -42,21 +42,21 @@ namespace sthread void thread_traits::exit() { - pthread_exit(NULL); + pthread_exit(nullptr); } template <> void thread_traits::join(_Ctype *c) { - pthread_join(c->getThreadIden(), NULL); + pthread_join(c->getThreadIden(), nullptr); } template <> void mutex_traits::init(pthread_mutex_t &m) { - pthread_mutex_init(&m, NULL); + pthread_mutex_init(&m, nullptr); } template <> @@ -77,7 +77,7 @@ namespace sthread void cond_traits::init(_Tcond &cond) { - pthread_cond_init(&cond, NULL); + pthread_cond_init(&cond, nullptr); } template <> @@ -127,7 +127,7 @@ namespace sthread { ct->exit(); } - return NULL; + return nullptr; } void * @@ -146,7 +146,7 @@ namespace sthread } if (counter) counter->decrease(); - return NULL; + return nullptr; } } #else diff --git a/dynare++/tl/cc/sthread.hh b/dynare++/tl/cc/sthread.hh index c932d0ea0..e705c97fd 100644 --- a/dynare++/tl/cc/sthread.hh +++ b/dynare++/tl/cc/sthread.hh @@ -302,7 +302,7 @@ namespace sthread { auto it = _Tparent::find(mmkey(c, id)); if (it == _Tparent::end()) - return NULL; + return nullptr; return &((*it).second); } @@ -502,7 +502,7 @@ namespace sthread { public: condition_counter *counter; - detach_thread() : counter(NULL) + detach_thread() : counter(nullptr) { } void diff --git a/dynare++/tl/cc/symmetry.cc b/dynare++/tl/cc/symmetry.cc index 6ebd71d4d..ac54b841b 100644 --- a/dynare++/tl/cc/symmetry.cc +++ b/dynare++/tl/cc/symmetry.cc @@ -57,7 +57,7 @@ Symmetry::isFull() const beginning as subordinal |symiterator|. */ symiterator::symiterator(SymmetrySet &ss) - : s(ss), subit(NULL), subs(NULL), end_flag(false) + : s(ss), subit(nullptr), subs(nullptr), end_flag(false) { s.sym()[0] = 0; if (s.size() == 2) diff --git a/dynare++/tl/cc/t_container.hh b/dynare++/tl/cc/t_container.hh index bf53841c3..2ecfac8e0 100644 --- a/dynare++/tl/cc/t_container.hh +++ b/dynare++/tl/cc/t_container.hh @@ -144,7 +144,7 @@ public: if (it == m.end()) { TL_RAISE("Symmetry not found in TensorContainer::get"); - return NULL; + return nullptr; } else { @@ -161,7 +161,7 @@ public: if (it == m.end()) { TL_RAISE("Symmetry not found in TensorContainer::get"); - return NULL; + return nullptr; } else { diff --git a/dynare++/tl/cc/t_polynomial.hh b/dynare++/tl/cc/t_polynomial.hh index cdddf8b18..6d80dca9b 100644 --- a/dynare++/tl/cc/t_polynomial.hh +++ b/dynare++/tl/cc/t_polynomial.hh @@ -65,7 +65,7 @@ class PowerProvider int nv; public: PowerProvider(const ConstVector &v) - : origv(v), ut(NULL), ft(NULL), nv(v.length()) + : origv(v), ut(nullptr), ft(nullptr), nv(v.length()) { } ~PowerProvider(); @@ -165,7 +165,7 @@ public: PowerProvider pwp(xval); for (int i = 1; i <= tp.maxdim; i++) { - const _Stype &xpow = pwp.getNext((const _Stype *) NULL); + const _Stype &xpow = pwp.getNext((const _Stype *) nullptr); for (int j = 0; j <= tp.maxdim-i; j++) { if (tp.check(Symmetry(i+j))) @@ -255,7 +255,7 @@ public: PowerProvider pp(v); for (int d = 1; d <= maxdim; d++) { - const _Stype &p = pp.getNext((const _Stype *) NULL); + const _Stype &p = pp.getNext((const _Stype *) nullptr); Symmetry cs(d); if (_Tparent::check(cs)) { diff --git a/dynare++/tl/cc/tl_static.cc b/dynare++/tl/cc/tl_static.cc index c15937b6f..9d3cf2ca4 100644 --- a/dynare++/tl/cc/tl_static.cc +++ b/dynare++/tl/cc/tl_static.cc @@ -10,9 +10,9 @@ TLStatic tls; TLStatic::TLStatic() { - ebundle = NULL; - pbundle = NULL; - ptriang = NULL; + ebundle = nullptr; + pbundle = nullptr; + ptriang = nullptr; } TLStatic::~TLStatic() diff --git a/dynare++/tl/cc/twod_matrix.cc b/dynare++/tl/cc/twod_matrix.cc index 7c6a2df25..38d1e885d 100644 --- a/dynare++/tl/cc/twod_matrix.cc +++ b/dynare++/tl/cc/twod_matrix.cc @@ -104,7 +104,7 @@ void TwoDMatrix::save(const char *fname) const { FILE *fd; - if (NULL == (fd = fopen(fname, "w"))) + if (nullptr == (fd = fopen(fname, "w"))) { TL_RAISE("Cannot open file for writing in TwoDMatrix::save"); } diff --git a/dynare++/tl/testing/monoms.cc b/dynare++/tl/testing/monoms.cc index f85284281..d34042489 100644 --- a/dynare++/tl/testing/monoms.cc +++ b/dynare++/tl/testing/monoms.cc @@ -505,11 +505,11 @@ DenseDerivGenerator::DenseDerivGenerator(int ng, int nx, int ny, int nu, Monom2Vector r(g, x); xcont = x.deriv(maxdimen); rcont = r.deriv(maxdimen); - uxcont = NULL; + uxcont = nullptr; for (int d = 1; d <= maxdimen; d++) { ts[d-1] = g.deriv(d); - uts[d-1] = NULL; + uts[d-1] = nullptr; } } diff --git a/dynare++/utils/cc/memory_file.cc b/dynare++/utils/cc/memory_file.cc index 9c8967ffe..31f89ab1d 100644 --- a/dynare++/utils/cc/memory_file.cc +++ b/dynare++/utils/cc/memory_file.cc @@ -49,7 +49,7 @@ ogu::calc_pos_line_and_col(int length, const char *str, int offset, } MemoryFile::MemoryFile(const char *fname) - : len(-1), data(NULL) + : len(-1), data(nullptr) { FILE *fd = fopen(fname, "rb"); if (fd)