Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V736. The behavior is undefined for...
menu mobile close menu
Additional information
toggle menu Contents

V736. The behavior is undefined for arithmetic or comparisons with pointers that do not point to members of the same array.

Jan 19 2016

The behavior is undefined if arithmetic or comparison operations are applied to pointers that point to items belonging to different arrays.

Consider the following example:

int a[10], b[20];
fill(a, b);
if (&a[1] > &b[2])

There is some bug in this code. For example, it could have been affected by bad "find and replace" in some lines. Assume that the '&' operators are unnecessary here. Then the fixed version should look like this:

if (a[1] > b[2])

This diagnostic is classified as: