cppcheck: commit 62702a6
built with: make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes
$ cppcheck --enable=all main.cpp
Checking main.cpp ...
main.cpp:7:11: style: Condition 'a==1' is always true [knownConditionTrueFalse]
if (a == 1) {}
^
main.cpp:4:13: note: Assignment 'a=0', assigned value is 0
int a = 0;
^
main.cpp:5:14: note: a is incremented', new value is 1
while (++a < 5) {
^
main.cpp:7:11: note: Condition 'a==1' is always true
if (a == 1) {}
^
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
output:
$ ./a.out 5
cppcheck: commit 62702a6
built with: make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes
Thanks! I can reproduce. I created ticket https://trac.cppcheck.net/ticket/9808
Fixed for me in 48a6852.