Friday, November 25, 2005

Good way to obfuscate code!


boolean isDiskFull() {
someReallyStupidSideEffect();
return(diskFullness);
}

regularRoutine() {
if(isDiskFull()); {
//doErrorHandling in here
}
}


Best part about this code? The error handling will always execute, and some side effect will always happen.

I'm not sure I would have allowed the semi colon after an if (or while, or for) without an in between statement - I probably would have required the {} for an empty statement. (Though legitimately, ';' is a statement!)

1 comment:

bryan said...

yeah man, that's some messed up code