-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Message:Move declarations of types of parameters for function into list of parameters.
-
Default Severity:Major
-
Impact:Low
-
Likelihood:High
-
Default Quality Profiles:Sonar way
-
Covered Languages:C, Objective-C
-
Remediation Function:Constant/Issue
-
Constant Cost:5min
-
PC-Lint:132, 1132,832,1832, 936, 1936, 937, 1937, 938, 1938
In 1978, Brian Kernighan and Dennis Ritchie published the first edition of The C Programming Language. This book, known to C programmers as "K&R", served for many years as an informal specification of the language. The version of C that it describes is commonly referred to as K&R C.
The K&R function definition syntax introduced in the book was later deprecated in the ANSI C and ISO C standards. Even though the K&R syntax is still supported in the ISO C11 standard, it's not in ISO C++ standard versions and is not considered readable by most C/C++ developers today.
Noncompliant Code Example
int foo(a, b) // Noncompliant K&R C syntax int a; char* b; { }
Compliant Solution
int foo(int a, char* b) { // Compliant }