MISRA C:2012 Rule 17.1
The standard header file <stdarg.h> shall not be used
Description
Rule Definition
The standard header file <stdarg.h> shall not be used1 .
Rationale
The rule forbids use of va_list
, va_arg
, va_start
, va_end
,
and va_copy
.
It is possible to use these features in ways where the behavior is not defined in the 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
.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Function |
Category: Required |
AGC Category: Required |
Version History
Introduced in R2014b1 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.