Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 1546

Show
Ignore:
Timestamp:
05/23/10 11:53:03 (15 years ago)
Author:
rsinfu
Message:

Fixed bugzilla 4109: writeln doesn't work with empty static array.

The variable obj can be a static array of length zero. obj.ptr should be used.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docsrc/changelog.dd

    r1545 r1546  
    88    $(WHATSNEW 
    99    $(LI std.functional: toDelegate now accepts callable(function pointers, delegates and objects implement opCall) ) 
    1010    $(LI std.traits: Added templates to get compile-time information about functions.) 
    1111    $(LI std.typecons: Added tie and AutoImplement.) 
    1212    ) 
    1313    $(BUGSFIXED 
    1414    $(LI $(BUGZILLA 2835): std.socket.TcpSocket doesn't actually connect) 
    1515    $(LI $(BUGZILLA 3200): std.xml doesn't follow spec for Tag.text) 
    1616    $(LI $(BUGZILLA 3873): std.range.repeat should have popBack defined) 
    1717    $(LI $(BUGZILLA 3880): std.regex functions with const/immutable Regex object) 
     18    $(LI $(BUGZILLA 4109): writeln doesn't work with empty static array) 
    1819    $(LI $(BUGZILLA 4202): Changset 1517 doesn't compile) 
    1920    ) 
    2021) 
    2122 
    2223<div id=version> 
    2324$(UL 
    2425    $(NEW 047) 
    2526    $(NEW 046) 
    2627    $(NEW 045) 
    2728    $(NEW 044) 
  • trunk/phobos/std/format.d

    r1499 r1546  
    20302030        if (f.spec == 'r') 
    20312031        { 
    20322032            // raw writes 
    20332033            foreach (i, e; obj) formatGeneric!(Writer, typeof(e)) 
    20342034                                    (w, &e, memberSpec); 
    20352035        } 
    20362036        else 
    20372037        { 
    20382038            if (obj.length == 0) return; 
    20392039            // formatted writes 
    2040             formatGeneric!(Writer, typeof(obj[0]))(w, &obj[0], memberSpec); 
     2040            formatGeneric!(Writer, typeof(obj[0]))(w, obj.ptr, memberSpec); 
    20412041            if (!f.innerTrailing) 
    20422042            { 
    20432043                foreach (i, e; obj[1 .. $]) 
    20442044                { 
    20452045                    w.put(' '); 
    20462046                    formatGeneric!(Writer, typeof(e))(w, &e, f); 
    20472047                } 
    20482048            } 
    20492049            else 
    20502050            {