-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
GCC -Wuseless-cast warnings #1777
Comments
That is actually a bug hiding here: e.g. case 0xBB: // map (eight-byte uint64_t for n follow)
{
std::uint64_t len;
return get_number(input_format_t::cbor, len) and get_cbor_object(static_cast<std::size_t>(len));
}
that only works if you can fit a 64bit unsigned integer into a size_t. |
Any idea how to proceed on this? |
@nlohmann Change |
I dont think there's a bug. The scenario would be that there's a platform that wants to read CBOR that has more than 4 billion things on a platform that has memory buffers that literally cannot hold 4 billion things. That won't work. I think maybe GCC is being too aggressive here. I'm tempted to say this is Behaving Correctly. What do you all think? (A patch could be to pragma-ignore this warning in our header for GCC if we want to be warnings-clean for our users). |
Technically possible on x86 with PAE. That said, couldn't the number of elements be small enough (e.g.
Certainly not. I would be OK with simply being clean for this warning though. |
This is a language concept not a platform concept. You're right about the Still I don't really think there is something to fix here? |
Well we could throw an exception if we try to read an array/object with uint64 size and have only a |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Fixed with #2902. |
Using the GCC
-Wuseless-cast
results in the following warnings:The text was updated successfully, but these errors were encountered: