Reputation: 6890
I'm using Boost (1.47.0 self compiled) and MinGW 4.6 (for C++0x features) for my application, but I get a load of warnings (I use -Werror) in Boost's JSON parsing code.
I don't get these errors on Linux or in MSVC (MSVC Boost is self compiled from the exact same source tree). Here are the errors and the lines they point to.
boost\property_tree\detail\json_parser_write.hpp|35|error: comparison is always true due to limited range of data type [-Werror=type-limits]
if (*b == 0x20 || *b == 0x21 || (*b >= 0x23 && *b <= 0x2E) ||
(*b >= 0x30 && *b <= 0x5B) || (*b >= 0x5D && *b <= 0xFF))
result += *b;
boost\property_tree\detail\json_parser_read.hpp|115|error: unused parameter 'e' [-Werror=unused-parameter]
void operator()(It b, It e) const
{
c.string += *b;
}
The errors seem sound, but is there a workaround that I'm missing?
Upvotes: 1
Views: 348
Reputation: 976
Regarding the first, I am guessing 'b' is defined as 'char *'? Whether char defaults to unsigned or signed is compiler-dependant AFAIK. It is possible mingw is defaulting the char to signed, making the comparisons with 0x0FF outside the possible range.
The second is self-explanatory, the warning is doing exactly what it is supposed to be doing, you should probably just disable that warning.
Upvotes: 1