mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
C++: respond to PR comments
This commit is contained in:
@@ -8,6 +8,11 @@
|
||||
<p>A function is called with arguments despite having an empty parameter list. This may indicate
|
||||
that the incorrect function is being called, or that the author misunderstood the function.</p>
|
||||
|
||||
<p>In C, a function declared with an empty parameter list `()` is considered to have an unknown
|
||||
parameter list, and therefore can be called with any set of arguments. To declare a function
|
||||
which takes no arguments, you must use `(void)` as the parameter list in any forward declarations.
|
||||
In C++, either style of declaration will be considered to take no arguments.</p>
|
||||
|
||||
</overview>
|
||||
<recommendation>
|
||||
<p>Call the function without arguments, or call a different function that expects the arguments
|
||||
|
||||
@@ -14,12 +14,12 @@ void test() {
|
||||
not_yet_declared1(1); // BAD
|
||||
not_yet_declared2(1); // GOOD
|
||||
|
||||
declared_empty_defined_with(); // BAD
|
||||
declared_empty_defined_with(); // BAD [NOT DETECTED]
|
||||
declared_empty_defined_with(1); // GOOD
|
||||
|
||||
int x;
|
||||
declared_empty_defined_with(&x); // BAD
|
||||
declared_empty_defined_with(x, x); // BAD
|
||||
declared_empty_defined_with(&x); // BAD [NOT DETECTED]
|
||||
declared_empty_defined_with(x, x); // BAD [NOT DETECTED]
|
||||
}
|
||||
|
||||
void not_yet_declared1();
|
||||
|
||||
Reference in New Issue
Block a user