CTFE output is kind of weired

Era Scarecrow via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 8 15:12:29 PDT 2017


On Saturday, 8 July 2017 at 21:29:10 UTC, Andre Pany wrote:
> app.d(17):        called from here: test("1234\x0a5678\x0a")
>
> I wrote the source code on windows with a source file with \r\n 
> file endings.
> But the console output has only the character X0a. In addition 
> not the content of tmp is shown but the full content with the 
> slice information [4..10].
>
> Is this the intended behavior?

  The escape sequence says it's hex, and 0a translates to 10, and 
0d is 13; \r\n is usually a 13,10 sequence. So from the looks of 
it the \r is getting stripped out.

  Funny story as i understand it, \r and \n both have very 
specific meanings to old printers in the old days. \r for 
carriage-Return, and \n for New-line. DOS may have used it, but 
\r more-or-less has no use for newlines and printers today.

  Curious when using writeln, all newlines seem to have \r 
sequences added. So i suppose it's one of those things that i 
never needed to think about really.


More information about the Digitalmars-d-learn mailing list