I'm trying to compile LightZPng with warnings on level 4. I get a lot of C4127 on lines that are clearly not worthy of this warning. An example:
#define MAX_BITS 15
int values_per_bitlen[ MAX_BITS + 1 ];
for ( int i = 0; i <= MAX_BITS; ++i ) // C4127 is here
values_per_bitlen[ i ] = 0;
How can this code be changed to avoid the warning other than #pragma?
There's a piece of code at the top of LightZ.cpp that goes like this:
#define for if (false) {} else for
That means your actual statement is:
#define for if (false) {} else for ( int i = 0; i <= MAX_BITS; ++i )
which is why you're getting the constant expression error (it's the false
, not the i <= MAX_BITS
as I thought).
Simply comment out or delete that line from the file (I can't actually figure out why they would do that).