MISRA C++: Rule Example (No Exception Handling in Safety-Critical) - Misra-c-cpp Typing CST Test
Loading…
MISRA C++: Rule Example (No Exception Handling in Safety-Critical) — Misra-c-cpp Code
Avoid exceptions in safety-critical code.
// Non-compliant
try {
/* code */
} catch (...) {}
// Compliant
if (error_condition) {
/* handle error */
}Misra-c-cpp Language Guide
MISRA C and MISRA C++ are coding standards developed to facilitate safety, reliability, and maintainability in embedded systems, especially in automotive, aerospace, and critical industries.
Primary Use Cases
- ▸Automotive embedded software development
- ▸Safety-critical avionics code
- ▸Industrial control firmware
- ▸Medical device software
- ▸High-integrity and mission-critical systems
Notable Features
- ▸Rule-based coding guidelines for C/C++
- ▸Focus on safety, reliability, and maintainability
- ▸Supports static analysis enforcement
- ▸Includes both mandatory and advisory rules
- ▸Covers C language and object-oriented C++ constructs
Origin & Creator
Created by the Motor Industry Software Reliability Association (MISRA) in 1998, initially for the automotive industry; later expanded to C++ and broader safety-critical domains.
Industrial Note
Extensively used in automotive ECUs, aerospace flight control software, industrial PLC firmware, and other high-integrity embedded systems.
More Misra-c-cpp Typing Exercises
MISRA C: Rule Example (Avoid Implicit Conversion)MISRA C++: Rule Example (No Dynamic Memory in Safety-Critical Code)MISRA C: Rule Example (Use of const)MISRA C: Rule Example (No goto)MISRA C: Rule Example (Initialize Variables)MISRA C++: Rule Example (Avoid Multiple Inheritance)MISRA C: Rule Example (Avoid Magic Numbers)MISRA C: Rule Example (Single Point of Exit)MISRA C: Rule Example (Boolean Expressions)