pnnl / SHAD

Scalable High-performance Algorithms and Data-structures
Apache License 2.0
122 stars 35 forks source link

Default values in extensions::data_types::data_types.h #246

Open marwick4 opened 11 months ago

marwick4 commented 11 months ago

Check the default values of different types and the return values of the many "catch" expressions. Many appear to return the wrong value. For example,

template <> constexpr uint64_t kNullValue = std::numeric_limits::max();

Should not the return value be std::numeric_limits::max();

For example,

template<> inline uint64_t data_types::encode<uint64_t, std::string, data_types::DOUBLE>(std::string &str) { uint64_t encval; double value; // auto [ptr, ec] = std::from_chars(str.data(), str.data() + str.size(), value); try { value = stod(str); } catch(...) { return kNullValue; } memcpy(&encval, &value, sizeof(value)); return encval; }

Should not the catch expression return kNullValue;