Definition:Can't Happen/Computer Science

From ProofWiki
Jump to navigation Jump to search

Definition

A branch of a program which, because of the way the flow is structured, cannot be accessed, is referred to as can't happen:

if (x == 1) then {
    do.something (x)
} else if (x != 1) then {
    do.somethingElse (x)
} else {
    // can't happen
}

There are sometimes reasons for doing stuff like this, but professionals usually wince when they have to maintain it.