4 ms·
> Barr’s group found 80,000 rule violations I'm a bit puzzled by this figure given that according to the article the typical LOC count of this kind of software
by astrobe_ 12y ago
> Barr’s group found 80,000 rule violations
I'm a bit puzzled by this figure given that according to the article the typical LOC count of this kind of software is within that order of magnitude ("tens of thousands of lines of code").
- ynik 12y ago"Normal" C code that is written in a coding style that disagrees with the MISRA guidelines can have more than 1 violation per line of code, even if the quality of the codebase is otherwise quite good. For example, the static analyser I'm working on finds 32700 violations of MisraC2012 in the SQLite codebase (130 kLOC). This is because Misra is quite strict about the use of C: a simple statement like `if (ptr) f();` already violates two rules: * use explicit `ptr != NULL` comparison * always use braces with `if` Once you get around to integer arithmetic, where MISRA is quite strict about not relying on implicit conversions or numeric promotion (which is non-portable due to depending on the size of `int`), it's not rare to have 5 or more violations in a single line of code.