The MISRA C:2012 – Guidelines for the Use of the C Language in Critical Systems (see [MISRA-C]) defines a subset of the C programming language that is safer—albeit also more restrictive—than the rules in this BARR-C coding standard.
If you are designing products that could kill or injure one or more people, the MISRA C guidelines are important to study and should be made part of your project’s coding standard. The MISRA C guidelines are now in their third edition and have been practiced for over two decades. Chances are that the authors of the MISRA C are more knowledgeable than you of the risks of using C in safety-critical systems.
In the present edition, every effort has been made to ensure that BARR-C’s rules can be combined with some or all of MISRA-C:2012’s guidelines. Specifically:
-
To the extent that a collection of the rules herein define a subset of the C programming language (e.g., limitations on the use of the register and goto keywords), they are never more restrictive than the MISRA C guidelines. Put another way, MISRA-C:2012 defines a subset of the C language that is itself a subset of the BARR-C rules.
-
To the extent that a collection of the rules herein place stylistic limitations on programmers (e.g., restricting the format of function or variable names), these never contradict the MISRA C guidelines. In other words, BARR-C comprises a C style guide that is complementary to MISRA C, which does not make any recommendations related purely to style.
A 2018 survey found that together these standards were the primary basis of the project-specific coding standards followed by more than 40% of firmware designers.