Tuesday, March 1, 2016

Android Studio Has Light Weight Formal?

Infinite loop caught a compile (not run) time

Static checking of code can find structural mistakes. But to catch dynamic mistakes, there needs to be a little formal analysis of the code to determine run time conditions that can lead to problems. In this example, an infinite loop ( while(1) ) was caught at compile time!

If the while(1) was changed to while(myTrue), the compiler misses it. So maybe no so formal after all!