TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C# Coding Standard
Search

Rule:  6@115Checked automatically with code checker

Synopsis:Do not access a modified object more than once in an expression
Language:C#
Severity Level:5
Category:Control flow


Description:

The evaluation order of sub-expressions within an expression is defined in C#, in contrast to C or C++, but such code is hard to understand.

Example:

v[i] = ++c;	 // right
v[i] = ++i;	 // wrong: is v[i] or v[++i] being assigned to?
i = i + 1;	 // right
i = ++i + 1;	 // wrong and useless; i += 2 would be clearer