Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: wordsmithing

...

In this noncompliant code example, the expression a++ is not evaluated, and the side effects in the expression are not executed:

Code Block
bgColor#FFcccc
langc
void func(void) {
  int a = 14;
  int b = sizeof(a++);
}

...

In this compliant solution, the variable a is incremented outside of the sizeof operation:

Code Block
bgColor#ccccff
langc
void func(void) {
  int a = 14;
  int b = sizeof(a);
  ++a;
}

...