MISRA C++:2023 Rule 21.10.1
Description
Rule Definition
The features of <cstdarg>
shall not be
used. 1
Rationale
The rule forbids use of va_list
, va_arg
, va_start
, va_end
, and va_copy
.
You can use these features in ways where the behavior is not defined in the C++ standard. For instance:
You invoke
va_start
in a function but do not invoke the correspondingva_end
before the function block ends.You invoke
va_arg
in different functions on the same variable of typeva_list
.va_arg
has the syntaxtype va_arg (va_list ap, type)
.You invoke
va_arg
with atype
that is incompatible with the actual type of the argument retrieved fromap
.
Polyspace Implementation
The checker reports a violation if you use any of these functions from
<sstdarg>
: va_list
, va_arg
,
va_start
, va_end
, and
va_copy
.
Troubleshooting
If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Language Support Library |
Category: Required |
Version History
Introduced in R2024b
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.