Movatterモバイル変換


[0]ホーム

URL:


CodeQL documentation
CodeQL resources

Call to function with extraneous arguments

ID: cpp/futile-paramsKind: problemSecurity severity: Severity: warningPrecision: very-highTags:   - correctness   - maintainabilityQuery suites:   - cpp-security-and-quality.qls

Click to see the query in the CodeQL repository

A function is called with more arguments than there are parameters of the function.

This may indicate that an incorrect function is being called, or that the signature (parameter list) of the called function is not known to the author.

In C, function calls generally need to provide the same number of arguments as there are arguments to the function. (Variadic functions can accept additional arguments.) Providing more arguments than there are parameters incurs an unneeded computational overhead, both in terms of time and of additional stack space.

Recommendation

Call the function with the correct number of arguments.

Example

voidone_argument();voidcalls(){one_argument(1);// GOOD: `one_argument` will accept and use the argumentone_argument(1,2);// BAD: `one_argument` will use the first argument but ignore the second}voidone_argument(intx);

References


[8]ページ先頭

©2009-2025 Movatter.jp