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.


  1. This comment has been removed by a blog administrator.


Post a Comment

Popular posts from this blog

Trouble installing KB2881553

February 5, 2005 Kshitij Day

How to create instance of MsftDiscMaster2 in C#