The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: dmr@plan9.bell-labs.com (Dennis Ritchie)
Subject: [TUHS] Why is \n 012?
Date: Sun, 9 Mar 2003 01:07:07 -0500	[thread overview]
Message-ID: <7816891f511016bfdc584185f2a11bb3@plan9.bell-labs.com> (raw)

Lehey wondered,

 > A thing that has puzzled me almost for ever is why the newline
 > character in C is 012 and not 015.  Does anybody have any insight?

And Haerr speculated 
 > Well, my take on this is that C was developed with UNIX,
 > of course, and UNIX early on decided to use a single
 > character rather than a two-char (CRLF) sequence for
 > end-of-lines...

This came via Unix from Multics.  My Multics
Programmers' Manual (1969) says, in reference
to its use of the ASCII character set: "Reference:
USA Standard X3.4-1967," and describes the LF
character, with code octal 012, "New Line.
Move carriage to the left edge of the next
line.... ASCII LF is used for this function."

I believe that either this or some other version
of ASCII standard blessed (or condoned) one
of the interpretations of the 012 character
for the new-line function.  However, I haven't
turned up hard evidence of this, despite several
conversations with Eric Fischer, who has
kept track of various versions of the standards.

In the event, various of the terminals used early
on did implement the NL function.  E.g. the
IBM 1050 and 2741 terminals (decidedly
non-ASCII) had a new-line function, like
a typewriter, no CR, but sometimes an
"Index" character that moved the paper
but not the printing element.  The TTY 37
had an optional interpretation of 012 as
NL.  Of course, other terminals required
separate CR and LF characters.

The choice of a single character to separate
lines still seems wise if you're using a byte-stream
model.

	Dennis




             reply	other threads:[~2003-03-09  6:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-09  6:07 Dennis Ritchie [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-09  3:20 Greg 'groggy' Lehey
2003-03-09  3:57 ` Greg Haerr
2003-03-09  6:19   ` M. Warner Losh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7816891f511016bfdc584185f2a11bb3@plan9.bell-labs.com \
    --to=dmr@plan9.bell-labs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).