http://www.jindent.com |
|
Next: Variable/Field Declarations |
Comments separate alignment chunks |
public class myClass { float a, b, c; // field declaration int d, e; // field declaration public void main() { int g; // variable declaration cout << "Hello World !"; // cout myFunction(); // method call d = bla(); // assingment b = c + 1; // assingment e = (a < 10); // assingment ... } } |
int a, b, c, d; // trailing comment int e, f, g, h, i, j; // trailing comment /* String declarations */ char[] k, l, m, n, o, p, q; // trailing comment char[] r, s, t, u, v, w; // trailing comment |
/* String declarations */
subdivides the variable declarations chunk into two subchunks.
As a result the trailing comments of first and second chunk are aligned different.
int a, b, c, d; // trailing comment int e, f, g, h, i, j; // trailing comment /* String declarations */ char[] k, l, m, n, o, p, q; // trailing comment char[] r, s, t, u, v, w; // trailing comment |
See also: | Exceeding lines separate alignment chunks |
Exceeding lines separate alignment chunks |
char[] abc = "abc"; | char[] defghi = "defghi"; | ALongClassName andALongFieldName = | new ALongClassName("12345","6789"); | long var = 1214159583925L; | char[] jklmnopq = "jklmnopq"; | |
andALongFieldName
subdivides the variable declarations chunk into two subchunks.
As a result the assignment of first and second chunk are aligned different.
char[] abc = "abc"; char[] defghi = "defghi"; ALongClassName andALongFieldName = new ALongClassName("12345","6789"); long var = 1214159583925L; char[] jklmnopq = "jklmnopq"; |
See also: | Comments separate alignment chunks |
Align reference operators & to types and not to names |
char & abc; | ALongClassName andALongFieldName; | long var; | char & jklmnopq; | |
char &abc; | ALongClassName andALongFieldName; | long var; | char &jklmnopq; | |
See also: | Space before reference operators & in types , Space after reference operators & in types , Space before reference operators & in names , Space after reference operators & in names |
Align dereference operators * to types and not to names |
char * abc; | ALongClassName andALongFieldName; | long var; | char * jklmnopq; | |
char *abc; | ALongClassName andALongFieldName; | long var; | char *jklmnopq; | |
See also: | Space before dereference operators * in types , Space after dereference operators * in types , Space before dereference operators * in names , Space after dereference operators * in names |