www.digitalmars.com         C & C++   DMDScript  

D.gnu - bug: write short.

$ cat writeShort.d
import std.stream;

int main()
{
File f = new File("test", FileMode.OutNew);
short s = 0;
int   i = 0;

f.printf("%d\n", s);
f.printf("%d\n", i);
f.close();

return 0;
}


$ dmd writeShort.d
$ ./writeShort
$ cat test
1073741824
0


It's very funny, if you change the order to printf int first, it behaves
correctly.

gdc version 0.10
gcc version 3.3.4
Linux 2.6.7-gentoo-r11
Feb 09 2005