K&R style

<programming>

An ugly, obsolete, deprecated source code indent style that looks like this:

 if (cond) {
	<body>
 }

The basic indent is eight spaces (or one tab) per level; less commonly four.

It is named after Kernighan & Ritchie because the examples in K&R are formatted this way. It is also called "kernel style" (because the Unix kernel was written in it) or Egyptian brackets.

This style was popular when programmers worked on small displays, or when printing code on paper, becuase it saves vertical space. It should be avoided because the opening brace is easy to miss at the end of a long condition in an "if" or "while" statement and it makes it hard to pair up braces.

Last updated: 2014-09-28

Nearby terms:

KRCK&R CkremvaxKRLKRSK&R styleKRYPTONkshKSLKSRKTH

Try this search on Wikipedia, OneLook, Google


Loading