Code Style: Difference between revisions

→‎Number Per Line: simplify because Spotless
(→‎White Space: Spotless handles spaces)
(→‎Number Per Line: simplify because Spotless)
Line 163:
== Declarations ==
==== Number Per Line ====
One declaration per line is recommended since it encourages commenting.
<pre>
int level; // indentation level
int size; // size of table
</pre>
 
Multiple declarations per line can be the best course of action only of the variables are strongly connected. For instance, if they are 3D coordinates:
<pre>
Line 177 ⟶ 171:
<pre>
int foo, fooarray[]; // AVOID!
</pre>
 
Note: The examples above use one space between the type and the identifier. Another acceptable alternative is to use tabs:
<pre>
int level; // indentation level
int size; // size of table
Object currentEntry; // currently selected table entry
</pre>
 
236

edits