589 – std.string.newline should be char[] not char[2]

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 589 - std.string.newline should be char[] not char[2]
Summary: std.string.newline should be char[] not char[2]
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks:
Reported: 2006年11月23日 18:05 UTC by Bill Baxter
Modified: 2014年02月15日 13:28 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Bill Baxter 2006年11月23日 18:05:22 UTC
std.string.newline is char[2], which means if you do 
 "astring"~newline
on a platform where newline is "\n" you'll get a lovely bonus Null character in your output.
It should either be made char[1] when it is one char, char[2] when it's not, or just char[] for all cases.
Comment 1 Matti Niemenmaa 2006年12月03日 04:04:08 UTC
Fixed in DMD 0.176 by making it char[1] when it's just \n.


AltStyle によって変換されたページ (->オリジナル) /