четверг, 17 марта 2011 г.

Interesting mistakes while programming


if (A) {
   Do1();
}
if (A && B) {
   Do2();
} else {
   Do3();
}
after some refactoring has changed to:

if (A) {
   Do1();
   if (B) {
      Do2();
   } else {
      Do3();
   }
}
These two fragments obviously aren't the same.