Showing posts from February, 2010

Compiler restrictions are no match for natural oversight

You'd think that with the restrictions in Java / C# that the only things you can put in an 'if' block be bool's, you'd avoid all kinds of single equals sign vs double equal sign errors, but look at what I ran into today:

bool IsGood = false;
bool IsSupposedToBeGood = false;
if (IsGood = IsSupposedToBeGood && otherConditions)
    // do something assuming IsGood is IsSupposedToBeGood

Sigh.. if the quantities you are checking equality for are bools, you're out of luck. I guess I can't let my guard down in C# / Java either, now.