A line length is the width occupied by a block of text. The unit of measurement is not standard. one can use centimeters, inches, picas, points or even column count. The requirements of the design coupled with the environment generally dictate the unit of measurement employed.
The rules and usage of line lengths in source code and documentation were an important aspect of coding standards for many years. During the computer age’s infancy, computer terminals were limited devices able to display a small, fixed number of columns. The coding standard dictated line length so that all involved in the project could properly view the source code.
However, with advancing technology came monitors that were more powerful and sophisticated editing environments. The importance of line lengths was deemphasized and in many cases, the rules faded from coding standards entirely. However, coding standards still define the rules and usages of line lengths in order to maximize readability.
One area where line lengths play a significant role in readability is in code comments. This is because of the inline C-style comments that are still widely used. Newer mechanisms, such as XML-based comments, remove the need for separate standards. However, with so much legacy code commented in the old style, a widely accepted change is unlikely soon.
A common line length for inline C-style comments is 40 characters. This means that the first line of comments will extend up to 40 characters and then the writer forces a line break, beginning the second line of comments. Coding standards generally do not allow for hyphens. In other words, it is appropriate to use less than 40 characters than to use more or to break a word up over two lines.
Coding standards often set line lengths for embedded text as well. For instance, SQL queries can be quite long. The standard dictates how the programmer breaks up the SQL query statement to maximize readability among team members.