S881 — Increment (++) and decrement (--) operators should not be used in a method call or mixed with other operators in an expression

Language
C#
Type
Code smell
Severity
Major

Why is this an issue?

The use of increment and decrement operators in method calls or in combination with other arithmetic operators is not recommended, because:

Noncompliant code example


u8a = ++u8b + u8c--;
foo = bar++ / 4;

Compliant solution

The following sequence is clearer and therefore safer:


++u8b;
u8a = u8b + u8c;
u8c--;
foo = bar / 4;
bar++;

↑ Back to top