Intypographyandcomputing,characters per line(CPL) orterminal widthrefers to the maximal number ofmonospacedcharacters that may appear on a singleline.It is similar toline lengthintypesetting.
History
editThe limit of the line length in 70–80 characters may well have originated from various technical limitations of various equipment. The Americanteletypewriterscould 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 cardconsisted of 80 characters. Widespread computer terminals such as DEC'sVT52andVT100mostly followed this standard, showing 80 CPL and 24 lines. This line length was carried over into the original 80×25text modeof 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
editWith the advent of desktop computing and publishing, and technologies such asTrueTypeused inword processingandweb browsing,a uniform CPL has been made mostly obsolete.HTML(and some other modern text presentation formats) uses dynamicword wrappingwhich is more flexible than characters per line restriction and may produce a text block with non-rectangular shape, just like in papertypesetting.
Manyplain textdocuments still conform to 72 CPL out of tradition (e.g.,RFC678).
In programming
editManystyle guidesforcomputer programmingdefine the maximum or desirable number of characters in a line ofsource code:
Characters per line | Programming style |
---|---|
72 | Ada[6] |
79 | Python[8][9] |
80 | |
88 | Python, TheBlackcode style[24] |
90 | CCM4[25] |
100 | Android[26] |
102 | Racket[31] |
120 | PHP[21] |
132 | Fortran[32](until 2023)[33] |
140 | Puppet[36] |
180 | Mono[37] |
undefined | Go[38]
JavaScript(JavaScript has no official style guide) |
With the increasing common use of larger widescreen monitors, some of these limits have been relaxed, as in the Linux kernel[39]and FreeBSD.[40]
See also
edit- IBM 80-column punched card format
- Common text modes
- Apple 80-Column Text Card
- Column (typography)
- Line length(the equivalent concept for non-monospaced text)
References
edit- ^Department of the Army, ed. (1947).Teletypewriter Circuits and Equipment (fundamentals).Washington: US Government Printing Office. p. 69.
- ^Pomerantz, Ori; Vander Weele, Barbara; Nelson, Mark; et al., eds. (2008).Mainframe Basics for Security Professionals.IBM Press.ISBN9780132704342.
- ^Wells, April J. (2003).Oracle 11i E-Business Suite from the Front Lines.CRC Press. p. 168.ISBN9780203508961.
- ^"Difference between..LRECL = 133 and LRECL = 132".IBMMAINFRAMES - IBM Mainframe Support Forums.2004.
- ^"Appendix K. Traditional Terminals and Printers".Terminals & Printers Handbook 1983–84.Digital. 1983.
- ^Ada 95 Quality and Style Guide
- ^agda/agda-stdlib: Style guide for the standard library
- ^PEP 8 Style Guide for Python Code
- ^Style Guide for Python Code
- ^GCC Coding Conventions
- ^Google C++ Style Guide
- ^Chromium Objective-C and Objective-C++ style guide
- ^Google Python Style Guide
- ^Google's R Style Guide
- ^Google JavaScript Style Guide
- ^"4.1. Line length".Java Code Conventions(PDF).Sun Microsystems, Inc. 1997. p. 5.
- ^"Linux kernel code style as of June 2020".git.kernel.org.Archivedfrom the original on 2020-05-31.Retrieved2020-06-13.
- ^"Object Pascal Style Guide".Archived fromthe originalon 2015-07-09.Retrieved2018-03-14.
- ^"style(9) - OpenBSD manual pages".Archivedfrom the original on 2016-05-24.Retrieved2024-03-04.
All code should fit in 80 columns.
- ^Conway, Damian (2005).Perl Best Practices: Standards and Styles for Developing Maintainable Code.O'Reilly. p. 40.ISBN978-0-596-55502-3.
- ^abPSR-2: Coding Style Guide
- ^The Ruby Style Guide
- ^OCaml Programming Guidelines
- ^"The Black code style - Black (stable) documentation".black.readthedocs.io.Retrieved2024-06-28.
- ^CCM4 self-imposed limit
- ^Android Code Style Guidelines for Contributors
- ^Common Lisp Style Guide
- ^Google Common Lisp Style Guide
- ^Google Java Style
- ^rustfmt Documentation
- ^How to Program Racket: a Style Guide
- ^FORTRAN 90
- ^Reid, John (2022-03-21),The new features of Fortran 202x(PDF)
- ^Blink Coding Style Guidelines
- ^Moodle Coding Style
- ^Leach, Parker."The Puppet language style guide".puppet.Retrieved2024-06-28.
- ^Mono Coding Guidelines
- ^Effective Go
- ^"The Linux Kernel Deprecates The 80 Character Line Coding Style".phoronix.Retrieved2024-05-31.
- ^"⚙ D30255 style: Relax 80 column rule".reviews.freebsd.org.Retrieved2024-05-31.