Bug 2970 – shared variables and std.stdio.writefln
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-05-12T19:18:00Z
Last change time
2015-06-09T01:27:57Z
Assigned to
nobody
Creator
echochamber
Comments
Comment #0 by echochamber — 2009-05-12T19:18:42Z
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)