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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 761 - std.format.doFormat fails for items of a char[][] containing %s
Summary: std.format.doFormat fails for items of a char[][] containing %s
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL: http://www.digitalmars.com/webnews/ne...
Keywords: patch
Depends on: 652
Blocks: 800
Show dependency tree / graph
Reported: 2006年12月28日 14:22 UTC by Lionello Lunesu
Modified: 2014年02月15日 13:26 UTC (History)
0 users

See Also:


Attachments
Fix by adding "bool parse" argument to doFormat; Adds write,writeln,fwrite,fwriteln (4.04 KB, patch)
2006年12月28日 14:23 UTC, Lionello Lunesu
Details | Diff
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Lionello Lunesu 2006年12月28日 14:22:09 UTC
#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 Lionello Lunesu 2006年12月28日 14:23:38 UTC
Created attachment 85 [details] 
Fix by adding "bool parse" argument to doFormat; Adds write,writeln,fwrite,fwriteln
Comment 2 Bruno Medeiros 2006年12月28日 18:05:38 UTC
See also #652
Comment 3 Walter Bright 2007年02月12日 03:34:53 UTC
Fixed DMD 1.005


AltStyle によって変換されたページ (->オリジナル) /