50 lines
833 B
Plaintext
50 lines
833 B
Plaintext
Declaring multiple variables on one line is difficult to read.
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
class MyClass {
|
|
|
|
private int a, b;
|
|
|
|
public void method(){
|
|
int c; int d;
|
|
}
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
class MyClass {
|
|
|
|
private int a;
|
|
private int b;
|
|
|
|
public void method(){
|
|
int c;
|
|
int d;
|
|
}
|
|
}
|
|
----
|
|
|
|
== See
|
|
|
|
* https://wiki.sei.cmu.edu/confluence/x/YTZGBQ[CERT, DCL52-J.] - Do not declare more than one variable per declaration
|
|
* https://wiki.sei.cmu.edu/confluence/x/EtcxBQ[CERT, DCL04-C.] - Do not declare more than one variable per declaration
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|