D - serious bug with bit variables
- "Pavel Minayev" <evilone omen.ru> Dec 20 2001
- "Walter" <walter digitalmars.com> Dec 20 2001
Compile and run the following program. Look at the
output.
import stdio;
class bits
{
bit a = true, b = true, c = true;
void dump()
{
printf("%d %d %d\n",
cast(int)(a == true),
cast(int)(b == true),
cast(int)(c == true));
}
}
int main(char[][] args)
{
bits k = new bits;
k.a = true; k.dump();
k.b = true; k.dump();
k.c = true; k.dump();
return 0;
}
Program had displayed:
1 0 0
0 1 0
0 0 1
No comments...
Dec 20 2001
That was caused by some confusion in the code generator as to whether a standalone bit was one byte or 4. A fix will go out with the next version. -Walter "Pavel Minayev" <evilone omen.ru> wrote in message news:9vtg4r$1p3p$1 digitaldaemon.com...Compile and run the following program. Look at the output. import stdio; class bits { bit a = true, b = true, c = true; void dump() { printf("%d %d %d\n", cast(int)(a == true), cast(int)(b == true), cast(int)(c == true)); } } int main(char[][] args) { bits k = new bits; k.a = true; k.dump(); k.b = true; k.dump(); k.c = true; k.dump(); return 0; } Program had displayed: 1 0 0 0 1 0 0 0 1 No comments...
Dec 20 2001








"Walter" <walter digitalmars.com>