#include <stdint.h> #include <stdio.h> #include <string.h> char test[50]; static void test_255match() { uint8_t addcnt; for (addcnt = 0; addcnt < 10; addcnt++) { printf("%u\n", addcnt); if (test[addcnt] == '+') { test[addcnt] = 0; addcnt--; printf("AFTER: %u\n", addcnt); if (addcnt != 255) { printf("CONDITION MATCHED:%u\n", addcnt); } else { printf("CONDITION NOT MATCHED:%u\n", addcnt); } } } } void main() { snprintf(test, sizeof(test), "A+CD"); test_255match(); snprintf(test, sizeof(test), "+BCD");...
#include <stdint.h> #include <stdio.h> #include <string.h> char test[50]; static void test_255match() { uint8_t addcnt; for (addcnt = 0; addcnt < 10; addcnt++) { printf("%u\n", addcnt); if (test[addcnt] == '+') { test[addcnt] = 0; addcnt--; printf("AFTER: %u\n", addcnt); if (addcnt != 255) { printf("CONDITION MATCHED:%u\n", addcnt); } else { printf("CONDITION NOT MATCHED:%u\n", addcnt); } } } } void main() { snprintf(test, sizeof(test), "A+CD"); test_255match(); snprintf(test, sizeof(test), "+BCD");...
#include <stdint.h> #include <stdio.h> #include <string.h> char test[50]; static void test_255match() { uint8_t addcnt; for (addcnt = 0; addcnt < 10; addcnt++) { printf("%u\n", addcnt); if (test[addcnt] == '+') { test[addcnt] = 0; addcnt--; printf("AFTER: %u\n", addcnt); if (addcnt != 255) { printf("CONDITION MATCHED:%u\n", addcnt); } else { printf("CONDITION NOT MATCHED:%u\n", addcnt); } } } } void main() { snprintf(test, sizeof(test), "A+CD"); test_255match(); snprintf(test, sizeof(test), "+BCD");...
#include <stdint.h> #include <stdio.h> #include <string.h> char test[50]; static void test_255match() { uint8_t addcnt; for (addcnt = 0; addcnt < 10; addcnt++) { printf("%u\n", addcnt); if (test[addcnt] == '+') { test[addcnt] = 0; addcnt--; printf("AFTER: %u\n", addcnt); if (addcnt != 255) { printf("CONDITION MATCHED:%u\n", addcnt); } else { printf("CONDITION NOT MATCHED:%u\n", addcnt); } } } } void main() { snprintf(test, sizeof(test), "A+CD"); test_255match(); snprintf(test, sizeof(test), "+BCD");...
Hi I had a few false positives - at least the messages would need to be updated (PossiblyAlwaysFalse, conditionTrueFalseWithoutOverflow, ...). Test case: #include <stdint.h> // Test case for cppcheck // Run with // cppcheck --enable=style,portability,warning,performance,unusedFunction te st.c // Results from cppcheck 2.16.0 - all false positive because overflow is expected uint8_t page_count = 0; uint8_t page_no = 0; void inc_address(void) { // test.c:13:30: note: Assignment 'page_count=page_count+16',...
Add pre-commit configuration/flow and some fixes
Code was fine in fact
GPRMC field 9 is not interpreted, do not use it as date