MISRA C/C++ Handles Embedded Applications, Too

March 27, 2025
Though MISRA C/C++ is associated with automotive design, the programming language works with any embedded application.

What you’ll learn:

  • Why MISRA C/C++ is used for automotive applications.
  • Why MISRA C/C++ is good for any application.
  • How can MISRA C/C++ be tuned for your application development process.

 

This video is the third in a series about MISRA C and MISRA C++ from the MISRA Consortium. These programming guidelines are designed to improve software quality by identifying and restricting functionality within the languages. MISRA C came about in the late 1990s and was targeted at the automotive space, where software was needed to meet the various Automotive Safety Integrity Levels (ASIL) used in software development for cars.

I talked with Andrew Banks, Technical Specialist at TASKING/LDRA, about why these standards are useful in non-automotive applications (watch the video above). We discuss why MISRA C/C++ should be used for any application.

Tailoring MISRA C/C++ for Embedded Applications

The guidelines focus on avoiding possible compiler differences, preventing the use of error-prone constructs, limiting complexity, and providing a set of best practices. The latter includes maintainability support using consistent naming conventions and commenting syntax.

>>Check out this TechXchange for similar articles and videos

112085047 © Monsit Jangariyawong | Dreamstime.com
misra_c_promo_txc_112085047__monsit_jangariyawong_
TechXchange

MISRA C/C++ for Writing Better Software

Originally developed for safety-critical automotive software, MISRA C/C++ standards have expanded to other areas of the electronics industry.

Many embedded applications are similar to automotive applications in that things like static memory allocation are preferred over dynamic memory allocation. Still, many embedded applications are easier to write or may require dynamic memory allocation. The rules employed by static-analysis tools can be adjusted to accommodate these preferences while checking for other rules that will help to develop safe and secure code.

The biggest challenge for embedded developers using MISRA C/C++ is to determine what mix of rules will work best for their development and design process. MISRA-C:2012 has 143 rules and 16 directives. MISRA C++:2008 included 228 coding rules.

Rules are classified as advisory, required, and mandatory. The mandatory part is more about certification that’s not necessarily needed for many embedded applications. It’s still a good idea to minimize weakening or excluding a rule.

A new version of MISRA C and MISRA C++ was published in 2023.

Using static-analysis tools is easiest when starting with a new code base. Applying it to an existing code base must usually be done in an incremental fashion, as the code likely won’t follow all of the rules. Likewise, changing the code to meet the rules can be challenging and potentially error-prone as well.

>>View Parts 1 and 2 of this video series

rh2010/Adobe Stock
Delving Into MISRA C/C++
Software

What is MISRA C/C++?

Part 1 of this series on MISRA C/C++ focuses on why the tool is useful for any C/C++ developer.
Tee11/Adobe Stock
What's the Difference in MISRA C and MISRA C++?
Software

What’s the Difference Between MISRA C and MISRA C++?

C and C++ are very different, and the MISRA guidelines address those disparities.

About the Author

William G. Wong | Senior Content Director - Electronic Design and Microwaves & RF

I am Editor of Electronic Design focusing on embedded, software, and systems. As Senior Content Director, I also manage Microwaves & RF and I work with a great team of editors to provide engineers, programmers, developers and technical managers with interesting and useful articles and videos on a regular basis. Check out our free newsletters to see the latest content.

You can send press releases for new products for possible coverage on the website. I am also interested in receiving contributed articles for publishing on our website. Use our template and send to me along with a signed release form. 

Check out my blog, AltEmbedded on Electronic Design, as well as his latest articles on this site that are listed below. 

You can visit my social media via these links:

I earned a Bachelor of Electrical Engineering at the Georgia Institute of Technology and a Masters in Computer Science from Rutgers University. I still do a bit of programming using everything from C and C++ to Rust and Ada/SPARK. I do a bit of PHP programming for Drupal websites. I have posted a few Drupal modules.  

I still get a hand on software and electronic hardware. Some of this can be found on our Kit Close-Up video series. You can also see me on many of our TechXchange Talk videos. I am interested in a range of projects from robotics to artificial intelligence. 

Sponsored Recommendations

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!