Closed mcrlc closed 4 years ago
I don't understand why you can't cast *(char *)
to uint32_t
- what does the error say?
As to the constant suffix, it is better to use UINT32_C(value)
since U and UL are platform specific.
The header needs
#ifndef UINT8_MAX
#include <stdint.h>
#endif
in order to use UINT32_C, although it is already included via flatcc_flatbuffers.h via flatcc_types.h, but that depends on the order of include files.
Regarding the char
to uint32_t
conversion, I actually found out an open bug in the GCC project for this type of conversions: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49626
As for the literal suffix, I'll probably fix them tomorrow.
Thanks for the quick turnaround :)
I'll try make a commit based on clangs -Wsign-conversion warnings. I'm not sure I want to deal with GCC bugs from 2011, that are still open. If you can't cast properly, all bets are off.
I agree, it's probably safe to suppress this warning on GCC.
For reference, the proposed changes were committed directly to master branch along with many others. See also related issue #151.
When building with GCC 7.5 and the following flags
-Wsign-conversion -Wconversion
these lines produced warnings. For some reason GCC didn't like the UL literal only in multiplications...151