Thread overview | ||||||
---|---|---|---|---|---|---|
|
December 19, 2013 [Issue 11782] New: format pointer to range prints range | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=11782 Summary: format pointer to range prints range Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: monarchdodra@gmail.com --- Comment #0 from monarchdodra@gmail.com 2013-12-19 13:56:13 PST --- //---- import std.string; void main() { auto a = iota(0, 10); auto p = &a; writefln("%s", a); writefln("%s", p); } //---- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] //---- This is not documented behavior. The documented behavior is simply: "Pointers are formatted as hex integers." The current behavior (pointer to ranges prints the range) makes no sense to me, and I don't see why a pointer to such a type would get a special treatment. I think this behavior is wrong, and should be removed to simply treat the pointer as a pointer. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2013 [Issue 11782] format pointer to range prints range | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | https://d.puremagic.com/issues/show_bug.cgi?id=11782 Dmitry Olshansky <dmitry.olsh@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dmitry.olsh@gmail.com --- Comment #1 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2013-12-19 14:01:16 PST --- (In reply to comment #0) > This is not documented behavior. The documented behavior is simply: "Pointers are formatted as hex integers." The fun is that a pointer to a range is a range. It naturally supports all of primitives. > I think this behavior is wrong, and should be removed to simply treat the pointer as a pointer. Maybe. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2013 [Issue 11782] format pointer to range prints range | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | https://d.puremagic.com/issues/show_bug.cgi?id=11782 --- Comment #2 from monarchdodra@gmail.com 2013-12-19 14:09:07 PST --- (In reply to comment #1) > (In reply to comment #0) > > > This is not documented behavior. The documented behavior is simply: "Pointers are formatted as hex integers." > > The fun is that a pointer to a range is a range. It naturally supports all of primitives. Almost ;) https://d.puremagic.com/issues/show_bug.cgi?id=11779 //---- import std.string; void main() { auto a = iota(0, 10).array(); auto p = &a; writefln("%s", a); writefln("%s", p); } //---- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 7FFF0ABA5FA0 //---- -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2013 [Issue 11782] format pointer to range prints range | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | https://d.puremagic.com/issues/show_bug.cgi?id=11782 --- Comment #3 from monarchdodra@gmail.com 2013-12-19 14:12:51 PST --- (In reply to comment #1) > (In reply to comment #0) > > > This is not documented behavior. The documented behavior is simply: "Pointers are formatted as hex integers." > > The fun is that a pointer to a range is a range. It naturally supports all of primitives. Also (but off topic here), while the slicing operator is still supported, the slice-able *trait* becomes lost, as the returned type (R) won't match the used type (R*). -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation