A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON
When building using Visual Studio 2022 through a vcpkg in win32 configuration, I am getting a down casting warning. As my solution has treat warnings as errors enabled, this prevents compilation. This warning is new as of 0.170.0 as I rolled back to 0.169.0 and did not have the same issue.
Compilation without warnings.
Compilation with a down casting warning
I found I was able to resolve the issue by using std::uintmax_t instead of std::size_t and long long.
// file: include/jsoncons_ext/jsonpath/expression.hpp
struct MyHash
{
std::uintmax_t operator()(string_type const& s) const noexcept
{
const int p = 31;
const int m = static_cast<int>(1e9) + 9;
std::uintmax_t hash_value = 0;
std::uintmax_t p_pow = 1;
for (char_type c : s) {
hash_value = (hash_value + (c - 'a' + 1) * p_pow) % m;
p_pow = (p_pow * p) % m;
}
return hash_value;
}
};
What compiler, architecture, and operating system?
When building using Visual Studio 2022 through a vcpkg in win32 configuration, I am getting a down casting warning. As my solution has treat warnings as errors enabled, this prevents compilation. This warning is new as of 0.170.0 as I rolled back to 0.169.0 and did not have the same issue.
Compilation without warnings.
Compilation with a down casting warning
I found I was able to resolve the issue by using
std::uintmax_t
instead ofstd::size_t
andlong long
.What compiler, architecture, and operating system?
What jsoncons library version?