Skip to content

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

@marwick4

Description

@marwick4

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions