Versions Compared

Key

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

...

Non-compliant Code Example 3

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

Code Block

func(i++, i++);

Compliant Solution

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

Code Block

i++;
func(i, i);

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

Code Block

j = i;
j++;
func(i, j);

Consequences

References