Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Characters per line

From Wikipedia, the free encyclopedia
Max number of monospaced characters allowed on a line
The ruler on the carriage of anOlivetti Lettera 22. This typewriter can print only 87 characters in a line
Typometer with the characters per line scales
AFortran coding form (paper). Source code has 72 CPL, but a form is 80-characters wide. Last 8 positions are "identification sequence"

Intypography andcomputing,characters per line (CPL) orterminal width refers to the maximal number ofmonospaced characters that may appear on a singleline. It is similar toline length intypesetting.

History

[edit]

The limit of the line length in 70–80 characters may well have originated from various technical limitations of various equipment. The Americanteletypewriters could type only 72 CPL, while the British ones even less, 70 CPL.[1] In the era oftypewriters, most designs of the typewriter carriage were limited to 80–90 CPL. Standard paper sizes, such as the international standardA4, also impose limitations on line length: using the US standardLetter paper size (8.5×11"), it is only possible to print a maximum of 85 or 102 characters (with the font size either 10 or 12characters per inch) without margins on the typewriter. With various margins – usually from 1–1.5 inches (25–38 mm) for each side, but there is no strict standard – these numbers may shrink to 55–78 CPL.

In computer technology, a line of an IBMpunched card consisted of 80 characters. Widespread computer terminals such as DEC'sVT52 andVT100 mostly followed this standard, showing 80 CPL and 24 lines. This line length was carried over into the original 80×25text mode of theIBM PC, along with its clones and successors. To this day, virtual terminals most often display 80×24 characters.

The "long" line of 132 CPL comes from mainframes'line printers.[2][3][4] However, some printers or printing terminals could print as many as 216 CPL, given certain extra-wide paper sizes and/or extra-narrow font sizes.[5]

In modern computing

[edit]

With the advent of desktop computing and publishing, and technologies such asTrueType used inword processing andweb browsing, a uniform CPL has been made mostly obsolete.HTML (and some other modern text presentation formats) uses dynamicword wrapping which is more flexible than characters per line restriction and may produce a text block with non-rectangular shape, just like in papertypesetting.

Manyplain text documents still conform to 72 CPL out of tradition (e.g.,RFC 678).

In programming

[edit]

Manystyle guides forcomputer programming define the maximum or desirable number of characters in a line ofsource code:

Characters per lineProgramming style
72
79
80
88
  • Python, TheBlack code style[24]
90
100
102
120
132
140
180
undefined

With the increasing common use of larger widescreen monitors, some of these limits have been relaxed, as in the Linux kernel[40] and FreeBSD.[41]

See also

[edit]

References

[edit]
  1. ^Department of the Army, ed. (1947).Teletypewriter Circuits and Equipment (fundamentals). Washington: US Government Printing Office. p. 69.
  2. ^Pomerantz, Ori; Vander Weele, Barbara; Nelson, Mark; et al., eds. (2008).Mainframe Basics for Security Professionals. IBM Press.ISBN 9780132704342.
  3. ^Wells, April J. (2003).Oracle 11i E-Business Suite from the Front Lines. CRC Press. p. 168.ISBN 9780203508961.
  4. ^"Difference between..LRECL = 133 and LRECL = 132".IBMMAINFRAMES.com - IBM Mainframe Support Forums. 2004.
  5. ^"Appendix K. Traditional Terminals and Printers".Terminals & Printers Handbook 1983–84. Digital. 1983.
  6. ^Ada 95 Quality and Style Guide
  7. ^agda/agda-stdlib: Style guide for the standard library
  8. ^PEP 8 Style Guide for Python Code
  9. ^Style Guide for Python Code
  10. ^Google C++ Style Guide
  11. ^Chromium Objective-C and Objective-C++ style guide
  12. ^Google Python Style Guide
  13. ^Google's R Style Guide
  14. ^Google JavaScript Style Guide
  15. ^"4.1. Line length".Java Code Conventions(PDF). Sun Microsystems, Inc. 1997. p. 5.
  16. ^"Linux kernel code style as of June 2020".git.kernel.org.Archived from the original on 2020-05-31. Retrieved2020-06-13.
  17. ^"Object Pascal Style Guide". Archived fromthe original on 2015-07-09. Retrieved2018-03-14.
  18. ^"style(9) - OpenBSD manual pages".Archived from the original on 2016-05-24. Retrieved2024-03-04.All code should fit in 80 columns.
  19. ^Conway, Damian (2005).Perl Best Practices: Standards and Styles for Developing Maintainable Code. O'Reilly. p. 40.ISBN 978-0-596-55502-3.
  20. ^abPSR-2: Coding Style Guide
  21. ^The Ruby Style Guide
  22. ^OCaml Programming Guidelines
  23. ^GCC Coding Conventions
  24. ^"The Black code style - Black (stable) documentation".black.readthedocs.io. Retrieved2025-07-27.
  25. ^CCM4 self-imposed limit
  26. ^Android Code Style Guidelines for Contributors
  27. ^Common Lisp Style Guide
  28. ^Google Common Lisp Style Guide
  29. ^Google Java Style
  30. ^rustfmt Documentation
  31. ^Zig Language Reference
  32. ^How to Program Racket: a Style Guide
  33. ^FORTRAN 90
  34. ^Reid, John (2022-03-21),The new features of Fortran 202x(PDF)
  35. ^Blink Coding Style Guidelines
  36. ^Moodle Coding Style
  37. ^Leach, Parker."The Puppet language style guide".puppet.com. Retrieved2024-06-28.
  38. ^Mono Coding Guidelines
  39. ^Effective Go
  40. ^"The Linux Kernel Deprecates The 80 Character Line Coding Style".www.phoronix.com. Retrieved2024-05-31.
  41. ^"⚙ D30255 style: Relax 80 column rule".reviews.freebsd.org. Retrieved2024-05-31.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Characters_per_line&oldid=1310526675"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp