Ada 95 Quality and Style Guide Chapter 2

Chapter 2: Source Code Presentation - TOC - 2.1 CODE FORMATTING

2.1.9 Source Code Line Length

guideline

  • Adhere to a maximum line length limit for source code (Nissen and Wallis 1984, §2.3).
  • instantiation

    Specifically, it is recommended that you:

    - Limit source code line lengths to a maximum of 72 characters.

    rationale

    When Ada code is ported from one system to another, there may be restrictions on the record size of source line statements, possibly for one of the following reasons: some operating systems may not support variable length records for tape I/O, or some printers and terminals support an 80-character line width with no line-wrap. See further rationale in the note for Guideline 7.1.2.

    Source code must sometimes be published for various reasons, and letter-size paper is not as forgiving as a computer listing in terms of the number of usable columns.

    In addition, there are human limitations in the width of the field of view for understanding at the level required for reading source code. These limitations correspond roughly to the 70- to 80-column range.

    exceptions

    An alternate instantiation is to limit source code length to 79 characters. The 79-character limit differentiates the code from the FORTRAN 72-character limit. It also avoids problems with 80-character width terminals where the character in the last column may not print correctly.

    automation notes

    The guidelines in this section are easily enforced with an automatic code formatter.


    < Previous Page Search Contents Index Next Page >
    1 2 3 4 5 6 7 8 9 10 11
    TOC TOC TOC TOC TOC TOC TOC TOC TOC TOC TOC
    Appendix References Bibliography