I can't reproduce this yet. I've created a single file which contains only the line from your message. And it doesn't generate any false positives with Cppcheck 2.4.1 (commit b01c9267f).
How does FAULT_MAX is defined in your code?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are trying to partially initialize an array of 4 elements, which violates rules 9.3. The MISRA document allows zero initialization only in form = { 0 }, but other forms including = { false } are forbidden. See the previous discussion for more details.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm seeing a false positive on the following:
static bool Fault[FAULT_MAX] = {false};
Error:
style: Required. Arrays shall not be partially initialized. [misra-c2012-9.3]
I'm using cppcheck 2.4.1.
Hello Amir,
Thanks for the report.
I can't reproduce this yet. I've created a single file which contains only the line from your message. And it doesn't generate any false positives with Cppcheck 2.4.1 (commit b01c9267f).
How does
FAULT_MAX
is defined in your code?Here is the definition:
Last edit: Amir 2021-07-15
Well, this is not a false positive then.
You are trying to partially initialize an array of 4 elements, which violates rules 9.3. The MISRA document allows zero initialization only in form
= { 0 }
, but other forms including= { false }
are forbidden. See the previous discussion for more details.