You are here

Indent_style


DESCRIPTION

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. Indentation is not a requirement of most programming languages, where it is used as secondary notation. Rather, programmers indent to better convey the structure of their programs to human readers. In particular, indentation is used to show the relationship between control flow constructs such as conditions or loops and code contained within and outside them. However, some programming languages use the indentation to determine the structure instead of using braces or keywords. The size of the indent is usually independent of the style. Many early programs used tab characters for indentation, for simplicity and to save on source file size. Unix editors generally view tabs as equivalent to eight characters, while Macintosh and Microsoft Windows environments would set them to four, creating confusion when code was transferred back and forth. Modern programming editors are now often able to set arbitrary indentation sizes, and will insert the appropriate combination of spaces and tabs. For Ruby, many shell programming languages, and some forms of HTML formatting, two spaces per indent level is generally used. The issue of using hard tabs or spaces is an ongoing debate in the programming community. Some programmers such as Jamie Zawinski feel that spaces instead of tabs increase cross-platform functionality. Others, such as the writers of the WordPress Coding Standards, believe the opposite, that hard tabs increase cross-platform functionality. There are a number of computer programs that automatically correct indent styles as well as the length of tabs. A famous one among them is, a program included with many Unix-like operating systems. These programs work best for those who use an indent style close to that considered proper by their programmers, those who use other styles will more likely become frustrated. Furthermore, indent has only been updated once in the past 6 years and does not work well either with C++ or GNU extensions to C.


CHARACTERISTICS

Operating System: 
License: 
Developer: