Cover by Steve McConnell

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Laying Out Individual Statements

This section explains many ways to improve individual statements in a program.

Statement Length

A common and somewhat outdated rule is to limit statement line length to 80 characters. Here are the reasons:

Cross-Reference

For details on documenting individual statements, see "Commenting Individual Lines" in Commenting Techniques.

  • Lines longer than 80 characters are hard to read.

  • The 80-character limitation discourages deep nesting.

  • Lines longer than 80 characters often won't fit on 8.5″ x 11″ paper, especially when code is printed "2 up" (2 pages of code to each physical printout page).

With larger screens, narrow typefaces, and landscape mode, the 80-character limit appears increasingly arbitrary. A single 90-character-long ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required