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.
And Mills warned: "The danger is that with a game like this you don't play how we set out to play, you try and do things you wouldn't normally do and that can't happen.
NNA - Future Bloc member Ahmad Fatfat said that the extension of the mandate of top Lebanese Army brass can't happen without the approval of his Hezbollah, explaining that General Michel Aoun's problem in this regard should accordingly be with his ally Hezbollah.
I feel sorry for him - we let him down in games; it can't happen again.
Insiders claimed that the 34-year-old singer was pretty upset when she got an email a couple of days later from Stefani saying that the playdate can't happen "not now and not ever".
We told him this can't happen as Home Minister ( Sushilkumar Shinde) had already announced," Shoaib Iqbal told M AIL T ODAY .
That can't happen in football, that can't happen again in my career and it certainly can't happen next season.
He was a fit young man but we can't guarantee an acute injury can't happen - no doctor in the world can guarantee an acute injury can't happen.
I thought about my 1 year old son and thought, 'This can't happen again, this can't happen to anyone else's child, this can't happen to our child.
Last year we recovered eight points in six games so I don't know why it can't happen this year.
Andrew Tyrie, chairman of the Treasury select committee, said he would seek assurances from the FSA that "it can't happen again".