Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marwick4 opened this issue Oct 21, 2023 · 0 comments
Open

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

marwick4 opened this issue Oct 21, 2023 · 0 comments

Comments

@marwick4
Copy link

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<uint64_t> = std::numeric_limits<int64_t>::max();

Should not the return value be std::numeric_limits<uint64_t>::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<uint64_t>; }
memcpy(&encval, &value, sizeof(value));
return encval;
}

Should not the catch expression return kNullValue;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant