V764. Possible incorrect order of arguments passed to function.


The analyzer detected a suspicious sequence of arguments being passed to a function: some of the arguments' names do not correspond with the names of the parameters they are meant to represent. It may indicate an error when passing values to a function.

Let we have the following declaration of the function:

void SetRGB(unsigned r, unsigned g, unsigned b);

Here's an example of incorrect code:

void Foo(){
  unsigned R = 0, G = 0, B = 0; 
  ....
  SetRGB(R, B, G);
  ....
}

When defining the object color, the programmer accidentally swapped the blue and green color parameters.

The fixed version of the code should look like this:

SetRGB(R, G, B);

According to Common Weakness Enumeration, potential errors found by using this diagnostic are classified as CWE-683.

You can look at examples of errors detected by the V764 diagnostic.


Bugs Found

Checked Projects
346
Collected Errors
13 188