To reproduce the warning, use cppcheck --enable=all --std=c++17 <filename>.cpp. Using the latest git head (2a4b28c267059b5520f47f528a67f903d910f2df), I get:
[if-init.cpp:6]: (warning) Suspicious condition. The result of find() is an iterator, but it is not properly checked.
I tried searching for it on trac.cppcheck.net, but couldn't find anything, so I thought I should mention it here.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am new to cppcheck, and was surprised to find that this code generates a warning:
To reproduce the warning, use
cppcheck --enable=all --std=c++17 <filename>.cpp
. Using the latest git head (2a4b28c267059b5520f47f528a67f903d910f2df), I get:I tried searching for it on trac.cppcheck.net, but couldn't find anything, so I thought I should mention it here.
Thanks for reporting this bug! I created this ticket: https://trac.cppcheck.net/ticket/9176
👍
I have another potential ticket for you, but I'll create a new thread for it since it is completely unrelated to this one. :)