Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: into material and addition

...

Integer values must not be allowed to wrap if they are used in any of the following ways:

  • As an array index
  • In integer operands of any pointer arithmetic
  • As a length or size of an object
  • As the bound of an array (for example, a loop counter)
  • , including array indexing;
  • the assignment expression for the declaration of a variable length array;
  • the postfix expression preceding square brackets [] or the expression in square brackets [] of a subscripted designation of an element of an array object; and
  • function arguments of type size_t or rsize_t (for example, As an argument to a memory allocation functionIn security-critical code).

Anchor
Addition
Addition

Addition

Addition is between two operands of arithmetic type or between a pointer to an object type and an integer type. This rule only applies to addition between two operands of arithmetic type. ( See ARR37-C. Do not add or subtract an integer to a pointer to a non-array object and  and ARR30-C. Do not form or use out of bounds pointers or array subscripts for information about adding a pointer to an integer.) .

Incrementing is equivalent to adding 1.

...