[Issue 3821] New: writeln doesn't detect recursive data structures yet

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 18 11:12:02 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3821

           Summary: writeln doesn't detect recursive data structures yet
           Product: D
           Version: 2.040
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: sean at invisibleduck.org
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-02-18 11:12:02 PST ---
import std.stdio, std.boxer;
void main() {
    auto a = new Box[1];
    a[0] = box(a);
    writeln(a); // Error: Stack Overflow
}

Produces a stack overflow, the writeln isn't able to detect loops yet.

In Python the print is able to detect loops:

>>> l = [1, 2]
>>> l[1] = l
>>> print l
[1, [...]]

-- 
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