www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Bool {post,pre}{inc,dec}-operators

reply Oskar Linde <oskar.lindeREM OVEgmail.com> writes:
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

/Oskar
Feb 28 2006
next sibling parent reply Kyle Furlong <kylefurlong gmail.com> writes:
Oskar Linde wrote:
 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
 
 /Oskar
This makes me sick to my stomach. I thought D was a beautiful language, but now I dont know.
Feb 28 2006
parent reply Jeremy <Jeremy_member pathlink.com> writes:
In article <du2qrk$61u$2 digitaldaemon.com>, Kyle Furlong says...
Oskar Linde wrote:
 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
 
 /Oskar
This makes me sick to my stomach. I thought D was a beautiful language, but now I dont know.
bools were *just* added... I'm sure Walter will fix these things -- don't go degrading the entire language because a brand new feature in a beta release is buggy. Keep up the good work... anyway, how often do you get to yell directly to the language's creator to get it made just the way you want it? :-D - Jeremy
Mar 01 2006
parent reply Kyle Furlong <kylefurlong gmail.com> writes:
Jeremy wrote:
 In article <du2qrk$61u$2 digitaldaemon.com>, Kyle Furlong says...
 Oskar Linde wrote:
 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

 /Oskar
This makes me sick to my stomach. I thought D was a beautiful language, but now I dont know.
bools were *just* added... I'm sure Walter will fix these things -- don't go degrading the entire language because a brand new feature in a beta release is buggy. Keep up the good work... anyway, how often do you get to yell directly to the language's creator to get it made just the way you want it? :-D - Jeremy
Here's the thing though: Even if I and others yell and scream and tear our hair out, Walter will implement it how he wants anyways. And yes, I sill think D is the best language around. (D the Language, not D the Framework)
Mar 01 2006
parent reply Jeremy <Jeremy_member pathlink.com> writes:
In article <du4sp7$1e50$2 digitaldaemon.com>, Kyle Furlong says...
Jeremy wrote:
 In article <du2qrk$61u$2 digitaldaemon.com>, Kyle Furlong says...
 Oskar Linde wrote:
 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

 /Oskar
 This makes me sick to my stomach. I thought D was a beautiful language, but
now I dont know.
bools were *just* added... I'm sure Walter will fix these things -- don't go degrading the entire language because a brand new feature in a beta release is buggy. Keep up the good work... anyway, how often do you get to yell directly to the language's creator to get it made just the way you want it? :-D - Jeremy
Here's the thing though: Even if I and others yell and scream and tear our hair out, Walter will implement it how he wants anyways. And yes, I sill think D is the best language around. (D the Language, not D the Framework)
Hrm.. I'm rather a D newbie :-D but it seems to be just what I want (given some time for things to become stable anyway). SO, I don't know how stubborn he is (or not) -- but this bool thing seems pretty crazy to leave as-is.. I couldn't imagine Walter not fixing this. What's the difference between the language / framework..? Framework being the phobos library? Jeremy
Mar 01 2006
parent reply Kyle Furlong <kylefurlong gmail.com> writes:
Jeremy wrote:
 In article <du4sp7$1e50$2 digitaldaemon.com>, Kyle Furlong says...
 Jeremy wrote:
 In article <du2qrk$61u$2 digitaldaemon.com>, Kyle Furlong says...
 Oskar Linde wrote:
 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

 /Oskar
 This makes me sick to my stomach. I thought D was a beautiful language, but
now I dont know.
bools were *just* added... I'm sure Walter will fix these things -- don't go degrading the entire language because a brand new feature in a beta release is buggy. Keep up the good work... anyway, how often do you get to yell directly to the language's creator to get it made just the way you want it? :-D - Jeremy
Here's the thing though: Even if I and others yell and scream and tear our hair out, Walter will implement it how he wants anyways. And yes, I sill think D is the best language around. (D the Language, not D the Framework)
Hrm.. I'm rather a D newbie :-D but it seems to be just what I want (given some time for things to become stable anyway). SO, I don't know how stubborn he is (or not) -- but this bool thing seems pretty crazy to leave as-is.. I couldn't imagine Walter not fixing this. What's the difference between the language / framework..? Framework being the phobos library? Jeremy
The D language is a specification for a high level programming language. The D Framework is the compilers, debuggers, IDE's, and command line tools, libraries, or lack there of, which help with writing, building, debugging, and maintaining programs written in the D language. IMHO, the D language is a beautiful thing, however the D framework is very much lacking as compared to Java, .NET, even C++.
Mar 01 2006
parent Jeremy <Jeremy_member pathlink.com> writes:
In article <du5fi2$28c7$1 digitaldaemon.com>, Kyle Furlong says...
Jeremy wrote:
 In article <du4sp7$1e50$2 digitaldaemon.com>, Kyle Furlong says...
 Jeremy wrote:
 In article <du2qrk$61u$2 digitaldaemon.com>, Kyle Furlong says...
 Oskar Linde wrote:
 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

 /Oskar
 This makes me sick to my stomach. I thought D was a beautiful language, but
now I dont know.
bools were *just* added... I'm sure Walter will fix these things -- don't go degrading the entire language because a brand new feature in a beta release is buggy. Keep up the good work... anyway, how often do you get to yell directly to the language's creator to get it made just the way you want it? :-D - Jeremy
Here's the thing though: Even if I and others yell and scream and tear our hair out, Walter will implement it how he wants anyways. And yes, I sill think D is the best language around. (D the Language, not D the Framework)
Hrm.. I'm rather a D newbie :-D but it seems to be just what I want (given some time for things to become stable anyway). SO, I don't know how stubborn he is (or not) -- but this bool thing seems pretty crazy to leave as-is.. I couldn't imagine Walter not fixing this. What's the difference between the language / framework..? Framework being the phobos library? Jeremy
The D language is a specification for a high level programming language. The D Framework is the compilers, debuggers, IDE's, and command line tools, libraries, or lack there of, which help with writing, building, debugging, and maintaining programs written in the D language. IMHO, the D language is a beautiful thing, however the D framework is very much lacking as compared to Java, .NET, even C++.
It is lacking... but this is mainly because it is so new, and that the language isn't very stable yet. Once a good IDE comes out for both Windows and Linux (LEDs port to Windows please?) and the compiler reaches a v1.0 state (with bool's fixed) -- I believe things will pick up. I also hope library support picks up, integrate DDL to help that out into the standard? Jeremy
Mar 01 2006
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----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-----
Mar 01 2006