[previous] MISRA-C:2004  Rule  16.1:  (Required) [next] Functions shall not be defined with a variable number of arguments.
There are a lot of potential problems with this feature. Users shall not write additional functions that use a variable number of arguments. This precludes the use of use of stdarg.h, va_arg, va_start and va_end.

Example Code:


/* PRQA S 2984 ++ */

#include "misra.h"
#include "m2cmex.h"

static S16 test_1601a( S16 n, ... );

extern S16 test_1601( void )
{
   S16 r;
   r = test_1601a( 2, "tom", "dick" );
   r = r + test_1601a( 1, "harry" );

   return r;
}

static S16 test_1601a( S16 n, ... )        /* MISRA Violation */
{
   return n;
}


QAC messages that encompass this guideline:

1337 Function defined with a variable number of parameters.



(c) The Motor Industry Research Association, 2004
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents