Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

K&R style

You are here: irt.org | FOLDOC | K&R style

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

 if (cond) {
	
 }

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.

(2014-09-28)

Nearby terms: kremvax « KRL « KRS « K&R style » KRYPTON » ksh » KSL

FOLDOC, Topics, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, ?, ALL

©2018 Martin Webb