On 9 October 2013 01:31, Thorsten Ottosen
invariant violation must always be checked by compiled-away assertions.
You seem completely obsessed to call it a precondition or invariant violation. Why? All you have to do is make it defined behavior in your library; then it isn't a bug and apparently everyone will be happy.
Your argument is that there is a bug in the program and that you should terminate anyway. Sadly, must programs have bugs, but we use them anyway.
Most programs don't have detectable (by code) bugs. Just make sure your engineers, business owners and clients understand the risk they are taking on.
In practice it matters for some to avoid UB.
I thought in practice it matters to avoid bugs.
It's a major benefit of using Java or C#.
And yet programming bugs happen in those languages too. The great thing about UB is that you can tell people "there be dragons; don't go there", and you can even add checks in some builds to detect such bugs. If the behavior is well defined, you can't do that, because a programmer could be legitimately calling it for that behavior. -- Nevin ":-)" Liber mailto:nevin@eviloverlord.com (847) 691-1404