Why is this an issue?
This is a draft version of a MISRA C++ 202x rule proposed for public review.
MISRA Rule 21.10.2
Analysis Type: Decidable,Single Translation Unit
In addition, none of the facilities that are specified as being provided by
<csetjmp> shall be used.
Note: use of
<setjmp.h> and the facilities it provides are also prohibited by this rule.
The use of
longjmp allow the normal function return mechanisms to be bypassed. Their use may result in
undefined and unspecified behaviour. For example, it is undefined behaviour if
longjmp results in the omission
of non-trivial object destruction.
Safety standards, such as IEC 61508 (Part 6, Table 6), encourage the use of the "single-entry single-exit" principle as part of the
"modular approach". Unstructured languages, such as assembly, allow jumps between arbitrary points in a program, violating this principle. C++, with
its concept of functions and the corresponding calling mechanism, enforces the "single-entry single-exit" principle through its language definition —
for example, multiple return statements within a function all return to the call site.
Note: the C++ Standard states that aspects of the behaviour associated with these facilities are defined in the related version of
ISO 9899 .
 Header file
A header file is considered to be any file that is included during preprocessing (for example via the
regardless of its name or suffix.
Copyright The MISRA Consortium Limited © 2023
S982 targets the same defect as this rule but for a non-mission-critical context.
External coding guidelines