Ada 95 Quality and Style Guide Chapter 2

Chapter 2: Source Code Presentation - TOC

2.2 SUMMARY

code formatting

  • Use consistent spacing around delimiters.
  • Use the same spacing as you would in regular prose.
  • Indent and align nested control structures, continuation
  • lines, and embedded units consistently.
  • Distinguish between indentation for nested control
  • structures and for continuation lines.
  • Use spaces for indentation, not the tab character (Nissen and Wallis 1984, §2.2).
  • Align operators vertically to emphasize local program
  • structure and semantics.
  • Use vertical alignment to enhance the readability of declarations.
  • Provide, at most, one declaration per line.
  • Indent all declarations in a single declarative part at the same level.
  • Align parameter modes and parentheses vertically.
  • Use blank lines to group logically related lines of text (NASA 1987).
  • Highlight the top of each package or task specification, the top of each program unit body, and the end statement of each program unit.
  • Start each statement on a new line.
  • Write no more than one simple statement per line.
  • Break compound statements over multiple lines.
  • Adhere to a maximum line length limit for source code (Nissen and Wallis 1984, §2.3).

  • < 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