I should have added the output of the test, this is shown below... $ /home/cameron/Desktop/testcase/build/cppcheck_testcase Taken 'else' branch, *ptr==1, max_value==10 Taken 'else' branch, *ptr==2, max_value==10 Taken 'else' branch, *ptr==3, max_value==10 Taken 'else' branch, *ptr==4, max_value==10 Taken 'else' branch, *ptr==5, max_value==10 Taken 'else' branch, *ptr==6, max_value==10 Taken 'else' branch, *ptr==7, max_value==10 Taken 'else' branch, *ptr==8, max_value==10 Taken 'else' branch, *ptr==9,...
Hi, When analysing some code with cppcheck 2.2 I seem to have found a false positive. It looks like cppcheck does not recognise that the pointer is incremented and so a subsequent check is not the same as a previous one. The following code shows that the increment actually occurs, the second conditional check of if (*ptr >= max_value) is not the same as the first one. Any advice would be appreciated. #include <stdio.h> #include <stdbool.h> bool inc_ptr_test(int max_value, int *ptr) { if (*ptr >=...