Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Changed "Quality Tradeoff" to "Applicability" and removed the "Related Guidelines" section

...

Code Block
bgColor#ccccFF
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
bgColor#ccccff
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

...