digitalmars.D.bugs - Incorrect output using bit[][]
- Alex Stevenson (35/35) Jan 15 2006 Stop me if I've got the wrong end of the stick but:
Stop me if I've got the wrong end of the stick but:
DMD seems to incorrectly set bits in arrays of bit arrays. The following
test program:
import std.stdio;
int main( char[][] args )
{
bit[][] foo;
foo.length = 5;
for( int i = 0; i < foo.length; ++i )
foo[i].length = 5;
foo[0][1] = true;
foo[1][0] = true;
foo[0][4] = true;
foo[4][0] = true;
foo[2][3] = true;
foo[3][2] = true;
for( int j = 0; j < 5; ++j )
writefln( foo[j] );
return 0;
}
gives output:
[false,false,false,false,false]
[true,false,false,false,false]
[false,false,false,false,false]
[false,false,false,false,false]
[true,false,false,false,false]
Obviously there should be more 'trues' - looks like only the first bit
in each array is set. If I change 'bit[][]' to 'byte[]][]' all the 1s
are in the right places:
[0,1,0,0,1]
[1,0,0,0,0]
[0,0,0,1,0]
[0,0,1,0,0]
[1,0,0,0,0]
Happens using DMD v0.143 under winXP and linux
Jan 15 2006








Alex Stevenson <ans104 cs.york.ac.uk>