D Conference Tango Phobos
Sean Kelly
sean at f4.ca
Mon Sep 17 10:36:23 PDT 2007
Matti Niemenmaa wrote:
> Sean Kelly wrote:
>> Janice Caron wrote:
>>> And what's with the .newline? Isn't "\n" supposed to translate to the
>>> platform-specific linebreak convention? Besides, it looks weird,
>>> having the newline specified differently from all the other bits of
>>> output.
>> You're free to use "\n" as well--it works in all the cases I've tried.
>> The .newline method is similar to std::endl in C++.
>
> "\n" doesn't translate to "\r\n" on Windows, .newline does.
Yup. This doesn't matter for console output, but it might matter for
file output. YMMV.
> (Also, .newline flushes, but that's beside the point.)
Not always :-) .newline doesn't flush if the output is to a console and
is not redirected, I believe. It's been somewhat difficult to find a
good balance between performance and logical behavior there, and the
current behavior is the best compromise between the two that we've been
able to come up with.
Sean
More information about the Digitalmars-d
mailing list