MISRAC2004-16.1
In this section:
Synopsis
(Required) Functions shall not be defined with a variable number of arguments.
Enabled by default
Yes
Severity/Certainty
Low/High

Full description
Functions that are defined using ellipsis (...) notation were found. This check is identical to MISRAC++2008-8-4-1.
Coding standards
- MISRA C:2004 16.1
(Required) Functions shall not be defined with a variable number of arguments.
- MISRA C++ 2008 8-4-1
(Required) Functions shall not be defined using the ellipsis notation.
Code examples
The following code example fails the check and will give a warning:
#include <stdarg.h>
int putchar(int c);
void
minprintf(const char *fmt, ...)
{
va_list ap;
const char *p, *s;
va_start(ap, fmt);
for (p = fmt; *p != '\0'; p++) {
if (*p != '%') {
putchar(*p);
continue;
}
switch (*++p) {
case 's':
for (s = va_arg(ap, const char *); *s != '\0'; s++)
putchar(*s);
break;
}
}
va_end(ap);
}
The following code example passes the check and will not give a warning about this issue:
int puts(const char *);
void
func(void)
{
puts("Hello, world!");
}