[Issue 6305] New: String literals doesn't already have a 0 appended to them
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 13 02:02:46 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6305
Summary: String literals doesn't already have a 0 appended to
them
Product: D
Version: D1
Platform: Other
OS/Version: Windows
Status: NEW
Severity: minor
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: verylonglogin.reg at gmail.com
--- Comment #0 from Denis <verylonglogin.reg at gmail.com> 2011-07-13 01:57:25 PDT ---
According to http://www.digitalmars.com/d/1.0/arrays.html#printf
"String literals already have a 0 appended to them"
But if we create static arrays, they are exactly one after another:
import std.stdio;
const s1 = "abcd", s2 = "EFG", s3 = "h";
void main() {
writefln("%s %s %s\n%s %s %s",
s1, *(s1.ptr + s1.length), cast(int) *(s1.ptr + s1.length),
s2, *(s2.ptr + s2.length), cast(int) *(s2.ptr + s2.length)
);
}
Prints:
abcd E 69
EFG h 104
If I missed something, I think this "something" should be mentioned in
documentation near citation above.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list