August 08, 2012

Leng: boolean expresions on conditionals

Only expressions of pure bool type (no implicit conversions) are allowed on conditions for conditional and loop structures. Pretty much like Java. Oh, and the assignment operator does not return a reference to the lvalue. Which means you cannot do:
int a, b, c, d;
a = b = c = d = 0;
Tell me the truth how many times have you really needed (or even wanted) to do that anyway?
The bool conditions are maybe a bigger loss because I'm really used to do
and now I will have to do
if(myPtr != Null)
But I think having a simpler and cleaner rule is worth the extra code.

No comments:

Post a Comment