|
|
|
|
|
by ngruhn
57 days ago
|
|
It can be used in static analysis or type checking. E.g. if (x >= 0) {
x += 10
if (x =< 9) {
// unreachable
}
}
By maintaining an interval of possible values of x, you can detect the unreachable branch, because the interval becomes empty: initial: [-oo, oo]
x >= 0 : [0, oo]
x += 10: [10, oo]
x =< 9 : [10, 9] (empty)
|
|