Indent style
In computer programming, an indent style is a convention governing the indentation of blocks of code to convey the program's structure. This article largely addresses the C programming language and its descendants, but can be (and frequently is) applied to most other programming languages (especially those in the curly bracket family). Indent style is just one aspect of programming style.
GNU style
The GNU style is a mixture of the BSD and Whitesmiths styles. Instead of putting the braces with the control statement or the statements within the braces, the braces are put at the halfway point between the two indent levels. Although not directly related to indentation, GNU coding style also includes a space before the bracketed list of arguments to a function.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
while (x == y)
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
something ();
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
somethingelse ();
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
}
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
finalthing ();
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
This style maintains the advantages of BSD while satisfying many of those who prefer Whitesmiths. The layout may be influenced by Richard Stallman's background of writing in Lisp. This style is the default behavior of GNU Emacs and is mandated by nearly all maintainers of GNU project software. It is rarely used outside of the free software community.
Related Topics:
Richard Stallman - Lisp - GNU Emacs - Free software
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Use of this style can be very awkward for those who do not use GNU emacs. Most editors can easily be set to assist in indenting for the other styles. Setting a non-emacs editor up to assist with GNU style is often impossible, since simple auto-indent is relatively unhelpful with the two different indentation levels that are required.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Link: GNU Formatting
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ Table of Content ~
| ► | Introduction |
| ► | K&R style |
| ► | BSD/Allman style |
| ► | Whitesmiths style |
| ► | GNU style |
| ► | Pico style |
| ► | See also |
~ What's Hot ~
~ Community ~
| ► | History Forum Come and discuss about History, Civilizations, Historical Events and Figures |
| ► | History Web-Ring A community of sites, blogs and forums dedicated to History. Do not hesitate to submit your site. |
and are licensed under the GNU Free Documentation License.
Lexicon - Privacy Policy - Spiritus-Temporis.com ©2005.