https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95512
--- Comment #4 from David Binderman <dcb314 at hotmail dot com> --- (In reply to anlauf from comment #3) > I didn't write the code, but for more context: Thanks for the extra context. > Maybe it is bad style, but I still consider it a false positive. If you go back and check what cppcheck is saying, it is merely mentioning what it thinks is bad style. > cppcheck's view is probably too narrow to understand the range of dim. Agreed. AFAIK cppcheck merely searches and reports on source code patterns like if (arrayName[ X] && X < someExpression) Whether you want to keep the code in bad style is up to you. I did originally suggest some code that looked IMHO to be better style.