Although the cppcheck has right, the assert is to make sure the variable is 0 and e.g. no one will change it to other value because code below the assert works only for 0. That's the idea of assert and the issue shouldn't be raised here.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using cppcheck 2.18.0
Here is code:
When running
cppcheck --enable=styleI have issue:Although the cppcheck has right, the assert is to make sure the variable is
0and e.g. no one will change it to other value because code below the assert works only for0. That's the idea of assert and the issue shouldn't be raised here.Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14315