...
Code Block | ||
---|---|---|
| ||
public class Example{ private T a,b,c[],d; public Example(T in){ a = in; b = in; c = (T[]) new Object[10]; d = in; } |
ThusAs a result, when a method of Object
like toString()
is overridden, a programmer might accidentally provide a general implementation for type T
without realizing that c
is an array.
...
This rule appears in the C++ Secure Coding Standard as DCL04-CPP. Do not declare more than one variable per declaration.
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
References
Wiki Markup |
---|
\[[JLS 05|AA. Java References#JLS 05]\] Section 6.1, "Declarations", Section 4.3.2, "The class Object" \[[ESA 05|AA. Java References#ESA 05]\] Rule 9: Put single variable definitions in separate lines. |