diff --git a/src/DataTree.hh b/src/DataTree.hh index 1b3453f50468a94a1c7524d4786eed28282d0339..f64e6228e40b22abfb7333fcbcea5a0614b9669d 100644 --- a/src/DataTree.hh +++ b/src/DataTree.hh @@ -106,7 +106,7 @@ protected: static string packageDir(const string &package); private: - const static int constants_precision{16}; + constexpr static int constants_precision{16}; //! The list of nodes vector<unique_ptr<ExprNode>> node_list; diff --git a/src/ExprNode.hh b/src/ExprNode.hh index 083f2f5a40342304177fba3933f5a72bc7e8f205..af4ed5e6618059bb96f8e8dcdd29e5b9d769b2ac 100644 --- a/src/ExprNode.hh +++ b/src/ExprNode.hh @@ -181,8 +181,8 @@ class ExprNode //! Used for caching of first order derivatives (when non-null) map<int, expr_t> derivatives; - const static int min_cost_matlab{40*90}; - const static int min_cost_c{40*4}; + constexpr static int min_cost_matlab{40*90}; + constexpr static int min_cost_c{40*4}; inline static int min_cost(bool is_matlab) { return(is_matlab ? min_cost_matlab : min_cost_c); }; //! Cost of computing current node diff --git a/src/ExternalFunctionsTable.hh b/src/ExternalFunctionsTable.hh index 56c1ee7481f090c7886845997ec9fc7a6336ea66..0b5b22c62b9fc93cc52080ee2d46af9b31716d7e 100644 --- a/src/ExternalFunctionsTable.hh +++ b/src/ExternalFunctionsTable.hh @@ -53,11 +53,11 @@ public: }; using external_function_table_type = map<int, external_function_options>; //! Symbol ID used when no external function exists that calculates the derivative - const static int IDNotSet = -1; + constexpr static int IDNotSet = -1; //! Symbol ID used when the derivative is obtained from the top-level function - const static int IDSetButNoNameProvided = -2; + constexpr static int IDSetButNoNameProvided = -2; //! Default number of arguments when nargs is not specified - const static int defaultNargs = 1; + constexpr static int defaultNargs = 1; private: //! Map containing options provided to external_functions() external_function_table_type externalFunctionTable; diff --git a/src/Statement.cc b/src/Statement.cc index 80d3548d12fc16279c1dc3df314e95c421eb29c2..e1f992a845ac32c4444dc13eb71c922231b2ea9e 100644 --- a/src/Statement.cc +++ b/src/Statement.cc @@ -143,8 +143,8 @@ void OptionsList::writeOutput(ostream &output, const string &option_group) const { // Initialize option_group as an empty struct iff the field does not exist! - unsigned idx = option_group.find_last_of("."); - if (idx < UINT_MAX) + size_t idx = option_group.find_last_of("."); + if (idx != string::npos) { output << "if ~isfield(" << option_group.substr(0, idx) << ",'" << option_group.substr(idx+1) << "')" << endl; output << " " << option_group << " = struct();" << endl;