example array.cpp error:C4146 Unary minus operator applied to unsigned type, the result is still unsigned. store.hpp 241
I use cmake build zfp and general example "arraycpp", but when i run it in visual stdio 2022, there's a error: C4146 Unary minus operator applied to unsigned type, the result is still unsigned. It is in store.hpp in 241 rows.I don't know how to fix it.
Nothing to be fixed here--the code is correct and unary negation is perfectly defined for unsigned types. Surely VS is just being overly cautious and giving a warning, not an error, right? And don't be fooled by Microsoft's documentation that suggests "An unsigned value is unchanged by the unary negation operator." That is blatantly false. For example, -(1u) == 0xff...fu.
We might look into suppressing this warning, but it should have no bearing on the correctness of the code.
thank you, i have finish it.
OK. I'm keeping the issue open for now as we may want to silence these compiler warnings.