![]() |
![]() |
1047 | ![]() |
||||
![]() | |||||||
| Constraint violations | |||||||
This is an error. A function is being declared with default argument syntax when the function has already been called. It is generally permitted in the C language (although not recommended) to call a function without previously declaring it; but this practice is not supported when the function is defined with default argument syntax. Message 1047 is generated when a function call precedes the function declaration and the declaration specifies default arguments. 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. For example:
/* PRQA S 1-9999 ++ */
/* PRQA S 1046,1047 -- */
extern int f1 (int, char);
int f2 (void)
{
f1 (0, 1);
f3 ();
}
extern int f1 (int a = 1, char b = 0); /* Message 1046, 1047 */
extern int f3 (int a = 1); /* Message 1046, 1047 */
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |