D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7620 - format has different output compared to writef
Summary: format has different output compared to writef
Status: RESOLVED DUPLICATE of issue 4532
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-01 09:58 UTC by Andrej Mitrovic
Modified: 2012-04-01 15:06 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2012-03-01 09:58:29 UTC
import std.string;
import std.stdio;

enum Foo { foo, bar }

void main()
{
    Foo foo;
    writefln("%s", foo);
    writeln(format("%s", foo));
}

Prints:
foo
0

I really think these two should be in sync with each other. It's hard to switch from writef debugging to log-based debugging when writef does one thing and format() does another.
Comment 1 bearophile_hugs 2012-03-01 10:09:16 UTC
See also issue 7571
Comment 2 Stewart Gordon 2012-04-01 15:06:00 UTC

*** This issue has been marked as a duplicate of issue 4532 ***