Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V763. Parameter is always rewritten...
menu mobile close menu
Analyzing projects
Additional information
toggle menu Contents

V763. Parameter is always rewritten in function body before being used.

Jul 13 2016

The analyzer detected a potential error in the body of a function: one of the function parameters is overwritten before being used, which results in losing the value passed to the function.

Consider the following example:

void Foo(Node A, Node B)
{
  A = SkipParenthesize(A);
  B = SkipParenthesize(A); // <=
  AnalyzeNode(A);
  AnalyzeNode(B);
}

The 'A' and 'B' parameters are mixed up because of a typo, which leads to assigning a wrong value to the 'B' variable. The fixed code should look like this:

void Foo(Node A, Node B)
{
  A = SkipParenthesize(A);
  B = SkipParenthesize(B); 
  AnalyzeNode(A);
  AnalyzeNode(B);
}

This diagnostic rule is classified as:

  • CERT-MSC13-C

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