Guidelines were considered as Rules. With the publication android coding guidelines pdf MISRA C:2012 a new category of Guideline was introduced – the Directive whose compliance is more open to interpretation, or relates to process or procedural matters.
Although originally specifically targeted at the automotive industry, MISRA C has evolved as a widely accepted model for best practices by leading developers in sectors including automotive, aerospace, telecom, medical devices, defense, railway, and others. Coding Standards are based on MISRA-C:1998.
The NASA Jet Propulsion Laboratory C Coding Standards are based on MISRA-C:2004. Part 6 of ISO 26262 Functional Safety – Road Vehicles cites MISRA C as being an appropriate sub-set of the C language. Basic SW Modules written in C language shall conform to the MISRA C 2012 Standard. When a new software project is started, the latest MISRA standard should be used.
Previous standards are still available for use with legacy software projects that need to refer to it. Advisory guidelines are considered good practice, but compliance is less formal.
Avoiding possible compiler differences, for example, the size of a C integer may vary but an INT16 is always 16 bits. Avoiding using functions and constructs that are prone to failure, for example, malloc may fail. Produce maintainable and debuggable code, for example, naming conventions and commenting. MISRA C:2012 separately classifies each guideline as either Single Translation Unit or System.
In order for a piece of software to claim to be compliant to the MISRA C Guidelines, all mandatory rules shall be met and all required rules and directives shall either be met or subject to a formal deviation. Advisory rules may be disapplied without a formal deviation, but this should still be recorded in the project documentation. Note: For compliance purposes, there is no distinction between rules and directives. Many MISRA C rules can be characterized as guidelines because under certain condition software engineers may deviate from rules and still be considered compliant with the standard.
Deviations must be documented either in the code or in a file. IEC TS 17961:2013 – C secure coding rules.