www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - 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
1074724864

(gdc 0.10 will print: 1073741824
see D.gnu/1027)

It's very funny, if you also printf int, it behaves correctly.

dmd v0.111
gcc version 3.3.3
Linux 2.6.7-gentoo-r11
Feb 09 2005