can't happen

can't happen

(programming)
The traditional program comment for code executed under a condition that should never be true, for example a file size computed as negative. Often, such a condition being true indicates data corruption or a faulty algorithm; it is almost always handled by emitting a fatal error message and terminating or crashing, since there is little else that can be done.

Some case variant of "can't happen" is also often the text emitted if the "impossible" error actually happens. Although "can't happen" events are genuinely infrequent in production code, programmers wise enough to check for them habitually are often surprised at how frequently they are triggered during development and how many headaches checking for them turns out to head off.

See also firewall code, professional programming.
References in classic literature ?
"It can't happen for some time," said the Tin Woodman, trying to speak cheerfully; "for we shall be able to keep Jinjur out of the palace until she manages to break down the doors."
And every time she had reflected that the days of romance are dead, and that that sort of thing can't happen nowadays.
'I don't wanna talk about my pain, I don't wanna talk about my suffering, I don't wanna talk about things that won't happen, can't happen. I don't want those conversations.
"Any parent who thinks this can't happen to their children is burying their head in the sand, I'm afraid.
"If we want our game to be taken seriously, these things can't happen. Imagine if this happened against Rangers live on TV?
Please put it at the top of your To Do list to double-check that this can't happen here, that fire regulations are up to date and that whenever there are renovations going on, that everyone is on their guard and no corners are cut.
"If it can't happen, it can't happen and you move on to the next one."
Summary: Patiala (Punjab) [India], Dec 23 (ANI): Reacting on his coach Uwe Hohn voicing concerns over the delay in procuring equipment, insufficient support staff and poor diet, Javelin thrower Neeraj Chopra on Sunday said that "things can't happen in a jiffy" in a big country.
He added: "This is embarrassing and there should be a system in place to make sure it can't happen again."
It can't happen," Wild forward Zach Parise told reporters.
It happens all the time in gung-ho gun cop America, and don't say it can't happen here.
He said, "With a connected device a hundredth of a penny might need to be sent, that can't happen today.

Full browser ?