[phobos] [dmd-internals] svn-->git migration

Jonathan M Davis jmdavisProg at gmx.com
Tue Jan 25 22:20:22 PST 2011


On Tuesday 25 January 2011 21:53:18 Sean Kelly wrote:
> On Jan 25, 2011, at 10:59 AM, Walter Bright wrote:
> > It obviously goes back at least as far as ASCII itself. LF means "line
> > feed", which advances the platen one line. CR means "carriage return"
> > which moves the print head to the beginning of the line. These are
> > separate operations, and a lot of older programs relied on it. ASCII
> > terminals (and teletypes) all operated this way.
> 
> Most (all?) internet protocols require CRLF for line termination as well.

Considering what \n and \r\n are typically used for, \r\n is technically the 
most correct, because you're both going to the next line and going to the 
beginning of the line. However, given that you really never need to just go to 
the beginning of the line or the same place on the next - or if you do, you need 
something a lot more powerful (like ncurses) - it's rather silly to use two 
characters for it. So, using \n makes good sense.

The problem, of course, is that there's plenty of legacy stuff that uses \r\n, 
and so it would take a while to go away, even if everything switched to it. But 
for whatever reason, Windows has never followed the rest of the world and 
switched to \n (possibly because they prize backwards compatability so much, or 
possibly because they just plain don't care what the rest of the computing world 
is up to), so we're still stuck with both. Really, I think that everything 
should use \n at this point, but until Windows starts to, we're pretty much 
stuck. And like any compatability problem between systems, it causes problems 
between systems.

At least the Mac now uses \n instead of \r. Otherwise, there would be _three_ 
ways to end a line that we'd have to deal with.

- Jonathan M Davis


More information about the phobos mailing list