Command “cppcheck --enable=all test.cpp” successfully founds following error:
[test.c:5]: (warning) Logical conjunction always evaluates to false: diag == 3 && diag == 1.
when cppcheck's version is 1.70 but no warning produced in case of version 1.71 and later.
test.cpp code is:
void pickle(baro_diff_data_t &result) { uint8_t diag = rxbuf[0] >> 6; if ((3 == diag) && (1 == diag)) { this->state = SENSOR_STATE_DEAD; } else { result.t = temp; } }
The reason is the usage of uint8_t which cppcheck did not interpret as an integer. This is fixed since https://github.com/danmar/cppcheck/commit/0bf85f9aa519adc6ca2eab3e9c0a1668cf8828a7
Log in to post a comment.
Command “cppcheck --enable=all test.cpp”
successfully founds following error:
when cppcheck's version is 1.70 but no warning produced in case of version 1.71 and later.
test.cpp code is:
The reason is the usage of uint8_t which cppcheck did not interpret as an integer. This is fixed since https://github.com/danmar/cppcheck/commit/0bf85f9aa519adc6ca2eab3e9c0a1668cf8828a7