...
Code Block | ||
---|---|---|
| ||
int max(a, b) int a, b; { return a >> b ? a : b; } |
Section 6.11 of the C99 standard, "Future language directions," states that "The use of function definitions with separate parameter identifier and declaration lists (not prototype-format parameter type and identifier declarators) is an obsolescent feature."
...
Code Block | ||
---|---|---|
| ||
int max(int a, int b) { return a >> b ? a : b; } |
Noncompliant Code Example (Function Prototypes)
...
Code Block | ||
---|---|---|
| ||
/* file_a.c source file */ int func(int one, int two, int three){ printf(""%d %d %d"", one, two, three); return 1; } |
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...
This rule appears in the C++ Secure Coding Standard as DCL07-CPP. Include the appropriate type information in function declarators.
References
Wiki Markup |
---|
\[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\] Forward and Section 6.9.1, ""Function definitions"" \[[ISO/IEC PDTR 24772|AA. C References#ISO/IEC PDTR 24772]\] ""IHN Type system"" and ""OTR Subprogram Signature Mismatch"" \[[MISRA 04|AA. C References#MISRA 04]\] Rule 8.2 \[[Spinellis 06|AA. C References#Spinellis 06]\] Section 2.6.1, ""Incorrect Routine or Arguments"" |
...
DCL06-C. Use meaningful symbolic constants to represent literal values in program logic 02. Declarations and Initialization (DCL)