In a previous post i mentioned a little bit of work i was doing to create a little feature would Simplify Boolean Expressions.  To refresh your memory it would allow you to transform:

   if ((!((Foo() && !Bar()) || (!Foo() && Bar()))) { //...

into

   if (Foo() == Bar()) { //...

Of course, this isn't valid in the case where Foo and Bar have side-effects, however, if you know that they don't then it should be a completely safe change to make.  The intent of this was to help you safely transform expressions that were gettign out of control into simpler and easier understand snippets.  Often when you do this (applying all sorts of combining and mutating boolean laws) it's quite simple to make a mistake, so having an automated tool would be very handy.

Now, it recently came to my attention that even with side effect free expressions this stuff could break down.  Say you'd written the following:

   if (bb || !bb) { //bb has no side-effects...

Then it should be safe to just transform that into:

   if (true) { //...

But it actually turns out that that's not necessarily the case.  There are two reasons i've found that that assumption might not hold.  Any ideas about what those might be?  Once i see the right responses i'll put them up here!