Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V619. Array is used as pointer to...
menu mobile close menu
Additional information
toggle menu Contents

V619. Array is used as pointer to single object.

Jul 03 2012

The analyzer has detected that the '->' operator is applied to a variable defined as a data array. Such a code might indicate incorrect use of data structures leading to incorrect filling of the structure fields.

Consider a sample of incorrect code:

struct Struct {
  int r;
};
...
Struct ms[10];
for (int i = 0; i < 10; i++)
{
  ms->r = 0;
  ...  
}

Using it in this way is incorrect, as only the first array item will be initialized. Perhaps there is a misprint here or some other variable should be used. This is the correct code:

Struct ms[10];
for (int i = 0; i < 10; i++)
{
  ms[i].r = 0;
  ... 
}

This diagnostic is classified as:

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