Lucky hour! Grab a free trial license — offer ends in 00:59:58. Claim now
This diagnostic rule is based on the MISRA (Motor Industry Software Reliability Association) manual for software development.
This rule only applies to C. You shouldn't use the '<stdarg.h>' header file that includes the 'va_list' type , as well as macros 'va_arg', 'va_start', ' va_end' and 'va_copy'. They are necessary for working with functions with a variable number of arguments. However, the improper use of the '<stdarg.h>' header file often causes undefined behavior.
Look at the example:
#include <stdint.h>
#include <stdarg.h>
void foo(va_list args)
{
double y;
y = va_arg(args, int);
}
void bar(uint16_t count, ...)
{
uint16_t x;
va_list ap;
va_start (ap, count); // <=
x = va_arg (ap, int);
foo(ap);
x = va_arg (ap, int);
}
void baz(void)
{
bar(1.25, 10.07);
}
The code above demonstrates several problems that can lead to undefined behavior. Note: the list below contains only the issues that relate to this diagnostic:
This diagnostic is classified as:
|
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: