Versions Compared

Key

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

...

Noncompliant Code Example

Code Block
bgColor#ffcccc
void process(int index) {
  assert(index++ > 0); /* side effect */
  /* ... */
}

...

Avoid the possibility of side effects in assertions.

Code Block
bgColor#ccccff
void process(int index) {
  assert(index > 0); /* no side effect */
  ++index;
  /* ... */
}

...