flatbuffers
flatbuffers copied to clipboard
comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’
Version: 23.5.26
After this change, the type of "size" becames to signed, but the field in class Verifier
still use size_t
, which is unsigned in C++ standard.
So this will lead to this compilation failure:
In file included from /home/lleo/FlatBuffers/23.5.26/include/flatbuffers/base.h:20,
from /home/lleo/FlatBuffers/23.5.26/include/flatbuffers/array.h:23,
from /home/lleo/FlatBuffers/23.5.26/include/flatbuffers/flatbuffers.h:24,
from /home/lleo/MyExample/main.cpp,
/home/lleo/FlatBuffers/23.5.26/include/flatbuffers/flexbuffers.h: In constructor ‘flexbuffers::Verifier::Verifier(const uint8_t*, size_t, std::vector<unsigned char>*, bool, size_t)’:
/home/lleo/FlatBuffers/23.5.26/include/flatbuffers/flexbuffers.h:1673:30: error: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Werror=sign-compare]
1673 | FLATBUFFERS_ASSERT(size_ < FLATBUFFERS_MAX_BUFFER_SIZE);
/home/lleo/FlatBuffers/23.5.26/include/flatbuffers/flexbuffers.h:1673:5: note: in expansion of macro ‘FLATBUFFERS_ASSERT’
1673 | FLATBUFFERS_ASSERT(size_ < FLATBUFFERS_MAX_BUFFER_SIZE);
| ^~~~~~~~~~~~~~~~~~
Has it been fixed yet?
--FLATBUFFERS_ASSERT(size_ < FLATBUFFERS_MAX_BUFFER_SIZE); ++FLATBUFFERS_ASSERT(static_cast<::flatbuffers::soffset_t>(size_) < FLATBUFFERS_MAX_BUFFER_SIZE);
This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale
, or this will be closed in 14 days.
This issue was automatically closed due to no activity for 6 months plus the 14 day notice period.