nikhil.io

K&R is the One True Indentation Style

Via Wikipedia. I am “not able rightly to apprehend the kind of confusion of ideas that could provoke” the genesis of other styles. “Haskell Style” has to be a joke (like this masterpiece) and I just pray I don’t encounter it in the wild1 🙏

// Allman
while (x === y)
{
  func1();
  func2();
}

// Horstmann
while (x === y)
{ func1();
  func2();
}

// Kernighan & Ritchie
while (x === y) {
  func1();
  func2();
}

// GNU
while (x === y)
  {
    func1();
    func2();
  }

// Haskell style
while (x === y)
  { func1()
  ; func2()
  ;
  }

// Ratliff style
while (x === y) {
  func1();
  func2();
  }

// Whitesmiths
while (x === y)
  {
  func1();
  func2();
  }

// Lisp style
while (x === y)
  { func1();
    func2(); }

See also: “Vertical Hanging Indent” is the One True Indentation Style

  1. Update: Not exactly HS but good grief.↩︎