December 20, 2001 serious bug with bit variables | ||||
|---|---|---|---|---|
| ||||
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...
| ||||
December 20, 2001 Re: serious bug with bit variables | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | 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... > > | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply