www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 761] New: std.format.doFormat fails for items of a char[][] containing %s

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=761

           Summary: std.format.doFormat fails for items of a char[][]
                    containing %s
           Product: D
           Version: 0.178
          Platform: PC
               URL: http://www.digitalmars.com/webnews/newsgroups.php?art_gr
                    oup=digitalmars.D.announce&article_id=6505
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: lio lunesu.com


#import std.stdio;
#void main() {




C:\dmd>dmd -run bug
[Error: std.format

This happens because doFormat is called recursively, once for each of the 
elements of the array. This means that there should never be any parsing for 
string elements, since there'll never be any 2nd argument to be formatted.

A possible fix (+patch) can be found at:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=6505

"Because the new doFormat takes the extra "bool parse" parameter, the fix is 
simple: invoke doFormat with parse set to false."


-- 
Dec 28 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=761






Created an attachment (id=85)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=85&action=view)
Fix by adding "bool parse" argument to doFormat; Adds
write,writeln,fwrite,fwriteln


-- 
Dec 28 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=761


brunodomedeiros+bugz gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |652








-- 
Dec 28 2006