[previous] 1046 [next] [E] Function is being declared with default argument syntax. This is a language extension.
Language extensions

Default arguments are a C++ specific feature, which is provided as an extension to ISO:C Standard by some compilers.

QA C will accept a constant expression or an object identifier as a default argument for a parameter, and use that argument whenever one is not provided explicitly in a function call.

This message will be issued for a declaration (but not a definition) of a function with default argument syntax.

For example:


/* PRQA S 1-9999 ++ */
/* PRQA S 1046 -- */

extern int f1 (int = 1, char = 0);         /* Message 1046 */

extern int gi;
extern int f2 (int = gi);                  /* Message 1046 */

extern int f3 (int a, char b = 0);         /* Message 1046 */

extern int f1 (int a = 1, char b = 0);     /* Message 1046 */

int f1 (int a = 11, char b = 10)           /* No message */
{
  return a + b + f2 () + f2 (0) + f3 (0);
}


MISRA-C:2004 Rules applicable to message 1046:

Rule  1.1  (Required) All code shall conform to ISO/IEC 9899:1990 C programming language, ISO 9899, amended and corrected by ISO/IEC 9899/COR1:1995, ISO/IEC 9899/AMD1:1995, and ISO/IEC 9899/COR2: 1996192


QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents