Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

are not allowed because it modifies the same value twice.

Non-

...

Compliant Code Example

...

In the following this example, the order of evaluation of the operands to + is undefined.

...

As a result, programs can not safely rely on the order of evaluatoin of operands between sequence pionts.

Compliant Solution

...

The following These examples are independend on the order of evaluation of the operands and can only be interpreted in one way.

Code Block
++i;
a = i + b[i];

Or altnerativelyalternatively:

Code Block
a = i + b[i+1];
++i;

Non-

...

Compliant Code Example

...

There is no ordering of subexpressions implied by the assignment operator, so the behavior of the following statements is undefined:

Code Block
i = ++i + 1;
a[i++] = i;

Compliant Solution

...

The following These statements are allowed by the standard:

Code Block
i = i + 1;
a[i] = i;

Non-

...

Compliant Code Example

...

The order of evaluation of arguments to a function is undefined.

Code Block
func(i++, i++);

Compliant Solution

The following This solution is appropiate when the programmer intends for both arguments to func() to be equivalent:

Code Block
i++;
func(i, i);

The following This solution is appropiate when the programmer intends for the second argument to be one greater than the first:

...