MISRA – More Irrelevant Software Requirements Again

on Mar 30, 10 • by Alen Zukich • with 4 Comments

What is MISRA? More Irrelevant Software Requirements Again…uh no but certainly the sentiment of many developers.  MISRA (Motor Industry Software Reliability Association) is a coding standard, which first released MISRA C in 1998 and has since been revised.  Obviously, this came out of the automotive sector...

Home » Software Compliance » MISRA – More Irrelevant Software Requirements Again

What is MISRA? More Irrelevant Software Requirements Again…uh no but certainly the sentiment of many developers.  MISRA (Motor Industry Software Reliability Association) is a coding standard, which first released MISRA C in 1998 and has since been revised.  Obviously, this came out of the automotive sector with a clear focus on helping software systems to be more reliable and maintainable.

MISRA has since grown.  Now you see more and more industries adopting these standards.   In 2008, MISRA released the C++ equivalent standard.  So the obvious question is, should I apply this to my software source code base?  In short, yes.  Maybe you don’t need ALL of the MISRA rules, but there are certainly some that are worth your time.

Examples range from the very simple checker rules sets that mostly fall into the coding style category:

MISRA C rule 19.1:  All #include directives in a file shall only be preceded by other preprocessor directives or comments.
MISRA C rule 2.2: You should only use /*…*/ style comments.

Down to more important issues (I hope everyone has the tools in place to find this):

MISRA C rule 9.1: Unintialized variables.

It really depends what you’re trying to accomplish.  Certain rules such as 9.1 are very important, while others can help you with portability or just serve to make your code more maintainable and less complex going forward.

Word of warning, taking an existing software code base and apply the entire MISRA rule set is guaranteed to throw many errors.  Take the zlib project, obviously not MISRA compliant, but to illustrate the impact of turning on all the MISRA rules, will throw over 5000+ issues.  That is an issue for every line of code…yeah that’s useful.  So be warned, don’t try to boil the ocean.  Start iteratively, even if that means only one rule at a time.

Related Posts

4 Responses to MISRA – More Irrelevant Software Requirements Again

  1. Twylite says:

    The point of MISRA is to improve quality of embedded software in the motor industry, to improve portability of code across platforms, and to reduce surprise errors from poorly understood corners of the C standard that you are more likely to encountered with embedded C compilers.

    Rule 2.2 for example suggests that you don’t use // comments, which are not universally supported in the embedded world (IIRC they aren’t a C standard, but a C++ one). Rule 19.1 reduces the chance of linking against the wrong function (if you have two functions with the same name, in different source files), which eliminates a class of subtle bugs.

    As you say, it depends on what you’re trying to accomplish – a bunch of MISRA’s rules offer little value for PC-based software and non-tiny processors.

  2. assistencia tecnica electrolux says:

    good article, i will add my feeds.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Scroll to top