Isn't crlf default on windows?

Hey there,
I just received a PR where someone replaced the default writeln macro with a write_crlf macro. What is the behavior of writeln? Does it produce CRLF lineendings on windows or is this change justified? If so, is there a way to achieve this by means of the standard library?

Thank you

1 Like

https://doc.rust-lang.org/1.16.0/std/macro.writeln!.html

On all platforms, the newline is the LINE FEED character (\n/U+000A) alone (no additional CARRIAGE RETURN (\r/U+000D).

Depending on the format you are writing, the change might be justified or not.

I know no equivalent in the stdlib for that, but a piece of code that does the platform-dependent printing based on the target isn't hard to write.

4 Likes