Specific constructs

Enum classes

After each comma that follows an enum constant, a line break is mandatory.

Variable declarations
  • One variable per declaration - Every variable declaration (field or local) declares only one variable: declarations such as int a, b; are not used.
  • Declared when needed -Local variables are not habitually declared at the start of their containing block or block-like construct. Instead, local variables are declared close to the point they are first used (within reason), to minimize their scope. Local variable declarations typically have initializers, or are initialized immediately after declaration.
Arrays

Any array initializer may optionally be formatted as if it were a "block-like construct." (especially when line-wrapping need to be applied).