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.

Comments

  1. Anonymous5:30 AM

    This comment has been removed by a blog administrator.

    ReplyDelete

Post a Comment

Popular posts from this blog

February 5, 2005 Kshitij Day

Trouble installing KB2881553

Dark Fonts and Colors for light theme in VS 11