digitalmars.D.bugs - [Issue 7866] New: Type printing too for single nulls
- d-bugmail puremagic.com (58/58) Apr 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7866
- d-bugmail puremagic.com (13/13) May 29 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7866
http://d.puremagic.com/issues/show_bug.cgi?id=7866 Summary: Type printing too for single nulls Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc --- Comment #0 from bearophile_hugs eml.cc 2012-04-08 17:23:23 PDT --- D2 code: import std.stdio; class Foo {} void main() { Foo[] bar = [null, new Foo]; foreach (f; bar) writeln(f); } Output, DMD 2.059beta3: null test.Foo But the first null is a Foo class empty reference, it's not just a null. So I'd like writeln to print more information about the type of the null, with an output like this: cast(Foo)null test.Foo Or: cast(test.Foo)null test.Foo If you want similar output is useful for structs too: import std.stdio; struct Foo {} void main() { Foo* f; writeln(f); } Currently prints: null But a better and more informative output may be: cast(Foo*)null Or: cast(test.Foo*)null Inside collections probably "null" is enough still, to avoid a too much long output: import std.stdio; struct Foo {} void main() { Foo*[] a = [null, null]; writeln(a); } Current output, acceptable: [null, null] -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 08 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7866 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2012-05-29 00:55:57 PDT --- See my comment in here: http://d.puremagic.com/issues/show_bug.cgi?id=8040#c3 *** This issue has been marked as a duplicate of issue 8040 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 29 2012