D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2970 - shared variables and std.stdio.writefln
Summary: shared variables and std.stdio.writefln
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-12 19:18 UTC by MIURA Masahiro
Modified: 2015-06-09 01:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description MIURA Masahiro 2009-05-12 19:18:42 UTC
Not sure if this is Phobos issue or DMD issue, but anyway...
std.stdio.writefln doesn't accept 'shared' variables correctly.

% cat shared.d
import std.stdio;

int a = 0;
shared int b = 0;

void main()
{
    writefln("a = [%d], b = [%d]", a, b);

    a = 42;
    b = 42;
    writefln("a = [%d], b = [%d]", a, b);
}
% dmd shared.d && ./shared
a = [0], b = []
a = [42], b = [*]
%

Note: '*' == chr(42)
Comment 1 Walter Bright 2009-10-06 02:20:25 UTC
Fixed dmd 2.033