Bool {post,pre}{inc,dec}-operators

Thomas Kuehne thomas-dloop at kuehne.cn
Wed Mar 1 10:11:47 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Oskar Linde schrieb am 2006-02-28:
> bool a = 0;
> --a;
> assert(a == false || a == true); // FAILS(!) (a is set to 255)
>
> bool t = true;
> bool b = t+t;
> assert(b == true); //OK
> bool c = 0;
> c++;
> c++;
> assert(c == true || c == false); // FAILS
>
> But:
>
> bool d = 0;
> d += 2;
> assert(d == true || d == false); // OK

Added to DStress as
http://dstress.kuehne.cn/run/o/opAdd_08_A.d
http://dstress.kuehne.cn/run/o/opAdd_08_B.d
http://dstress.kuehne.cn/run/o/opAdd_08_C.d
http://dstress.kuehne.cn/run/o/opAdd_08_D.d
http://dstress.kuehne.cn/run/o/opCom_01_A.d
http://dstress.kuehne.cn/run/o/opCom_01_B.d
http://dstress.kuehne.cn/run/o/opNeg_05_A.d
http://dstress.kuehne.cn/run/o/opNeg_05_B.d
http://dstress.kuehne.cn/run/o/opPos_05_A.d
http://dstress.kuehne.cn/run/o/opPos_05_B.d
http://dstress.kuehne.cn/run/o/opPostDec_12_A.d
http://dstress.kuehne.cn/run/o/opPostDec_12_B.d
http://dstress.kuehne.cn/run/o/opPostInc_12_A.d
http://dstress.kuehne.cn/run/o/opPostInc_12_B.d
http://dstress.kuehne.cn/run/o/opPreDec_12_A.d
http://dstress.kuehne.cn/run/o/opPreDec_12_B.d
http://dstress.kuehne.cn/run/o/opPreInc_12_A.d
http://dstress.kuehne.cn/run/o/opPreInc_12_B.d
http://dstress.kuehne.cn/run/o/opSub_08_A.d
http://dstress.kuehne.cn/run/o/opSub_08_B.d
http://dstress.kuehne.cn/run/o/opSub_08_C.d
http://dstress.kuehne.cn/run/o/opSub_08_D.d

Thomas



-----BEGIN PGP SIGNATURE-----

iD8DBQFEBfAq3w+/yD4P9tIRAi9DAJ4ilny28jax2WH69QwNYNyv4Ks+zACgvgEm
mnxOu6CuBh/BRtMCu0POleU=
=1Z6B
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list