encoding of EOL in string literals

BCS ao at pathlink.com
Sun Feb 11 20:04:17 PST 2007


I'm not complaining , just wondering if this is correct.

This code produces the exact same output regardless of the type of end-of-line 
(\n, \n\r or \r) used

import std.stdio;
void main()
{
	foreach(char c; "hello
world
")
	writef("%s\n", cast(ubyte) c);
}

On linux for all three cases the output is:

104
101
108
111
10
119
111
114
108
100
10

This indicates that the EOLs are all handled before the parsing of the string.




More information about the Digitalmars-d-learn mailing list