| ▲ | jcranmer 2 hours ago | |||||||
One of the tricky things is that undefined behavior is commonly understood as having an unlimited "blast radius" and implementation-defined behavior is commonly understood as not permitting that kind of "blast radius." So any extension point that needed that unlimited "blast radius" had to be undefined behavior. (This has changed somewhat in modern times, but it does hold a little bit today--I'd point you to the discussion of N3863 at the most recent meeting, but I don't have any minutes that I feel really captured that discussion well enough.) And one of those kinds of "blast radius" is traps, and I suspect the original motivation for making signed integer overflow undefined behavior was precisely to preserve the ability to trap on signed integer overflow, which couldn't be implementation-defined. But the records of the discussions leading up to C89 and C99 are just too fragmentary for me to be certain. | ||||||||
| ▲ | userbinator an hour ago | parent | next [-] | |||||||
The problem with UB, as evidenced over the years, is that it causes compiler writers to drift much too far from reality, despite the standard itself suggesting "behaving [...] in a documented manner characteristic of the environment" as one of the (better) choices. | ||||||||
| ▲ | Joker_vD an hour ago | parent | prev [-] | |||||||
> And one of those kinds of "blast radius" is traps, Wait. An implementation-defined behaviour isn't allowed to be trap/termination of execution? Okay, make it unspecified then, with the options of trapping or calculating some unspecified (not indeterminate) integer value. > N3863 Hm?
Eh, I'd argue that omission of such a list is merely an implicit infinite ("two or more", you know) list of possibilities, its construction being self-evident.
There is an infinite list of possible ways to map multibyte characters to the source character set — an implementation has to pick one and document it.
There is an infinite list of possible diagnostic messages...
There is an infinite list of possible C identifiers that an implementation may chose as the name of the function to call at program startup. | ||||||||
| ||||||||