Bug 761 – std.format.doFormat fails for items of a char[][] containing %s

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-12-28T14:22:00Z
Last change time
2014-02-15T13:26:33Z
Keywords
patch
Assigned to
bugzilla
Creator
lio+bugzilla
Depends on
652
Blocks
800

Attachments

IDFilenameSummaryContent-TypeSize
85write.patchFix by adding "bool parse" argument to doFormat; Adds write,writeln,fwrite,fwritelntext/plain4140

Comments

Comment #0 by lio+bugzilla — 2006-12-28T14:22:09Z
#import std.stdio; #void main() { # const char[][] x = ["%s","123"]; # writefln(x); #} 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."
Comment #1 by lio+bugzilla — 2006-12-28T14:23:38Z
Created attachment 85 Fix by adding "bool parse" argument to doFormat; Adds write,writeln,fwrite,fwriteln
Comment #2 by bruno.do.medeiros+deebugz — 2006-12-28T18:05:38Z
See also #652
Comment #3 by bugzilla — 2007-02-12T03:34:53Z
Fixed DMD 1.005