I was glad that CppCheck noticed the mistake. But it was shown as a style error. Would you please consider to show this kind of error as real warnings instead of style warning. Because this kind of mistakes really break the functionality of the code.
The rule right now is that we use error if there IS undefined behavior whenever the code is executed. The warning severity means there can be undefined behavior.
I can agree that the name "style" is misleading. Most of the checks that use that severity tries to find suspicious code that can lead to real bugs. We try to avoid purely stylistic checks.
If Cppcheck finds suspicious code it is impossible to say if there is a bug or not. Maybe the code works exactly as the programmer wants.
Last edit: Daniel Marjamäki 2020-07-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Recently I made the following mistake in my code:
if( data[0] & 0x7F == 0x11 )
{
}
I was glad that CppCheck noticed the mistake. But it was shown as a style error. Would you please consider to show this kind of error as real warnings instead of style warning. Because this kind of mistakes really break the functionality of the code.
The rule right now is that we use
error
if there IS undefined behavior whenever the code is executed. Thewarning
severity means there can be undefined behavior.I can agree that the name "style" is misleading. Most of the checks that use that severity tries to find suspicious code that can lead to real bugs. We try to avoid purely stylistic checks.
If Cppcheck finds suspicious code it is impossible to say if there is a bug or not. Maybe the code works exactly as the programmer wants.
Last edit: Daniel Marjamäki 2020-07-17