Bug 16561 – API documentation: C runtime behavior of std.ascii.newline

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2016-09-28T17:20:22Z
Last change time
2024-12-01T16:28:01Z
Keywords
trivial
Assigned to
No Owner
Creator
Andre
Moved to GitHub: phobos#10202 →

Comments

Comment #0 by andre — 2016-09-28T17:20:22Z
For users without C knowledge there is some magic if std.stdio.File was opened with "w". I just learned the C runtime translates \n to \r\n in the background. I was using std.ascii.newline because I tried to write OS independent code, but I wondered why the file endings where somehow broken. Please see https://forum.dlang.org/post/[email protected] The API reference https://dlang.org/phobos/std_stdio.html#.File lacks information about this behavior. There is only a link to a C documentiation (http://cplusplus.com/reference/clibrary/cstdio/fopen.html) which also do not explain this behavior. The only hint is: Use std.ascii.newline for portability (unless the file was opened in text mode) The API documentation should be enhanced to avoid other D users will fell into this trap.
Comment #1 by robert.schadek — 2024-12-01T16:28:01Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10202 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB