...
Code Block | ||
---|---|---|
| ||
public class Example { private T a; // purpose of a... private T b; // purpose of b... private T[] c; // purpose of c[]... private T d; // purpose of d... public Example(T in){ a = in; b = in; c = (T[]) new Object[10]; d = in; } } |
...
Applicability
Declaration of multiple variables per line can reduce code readability and lead to programmer confusion.
...
Code Block | ||
---|---|---|
| ||
public class Example { void function() { int mx = 100; // some max value for (int i = 0; i < mx; ++i ) { /* ... */ } } } |
Related Guidelines
C Secure Coding Standard: DCL04-C. Do not declare more than one variable per declaration
...
Bibliography
Section 6.1, "Number Per Line" | |
[ESA 2005] | Rule 9: Put single variable definitions in separate lines. |
[JLS 2011] | |
| |
| |
| |
|
...