3 ms·
> I have never seen even a single example of "undefined behavior" that I thought was justified. All "undefined behavior" that I have seen could have been replac
by Someone 5y ago
> I have never seen even a single example of "undefined behavior" that I thought was justified. All "undefined behavior" that I have seen could have been replaced with "the compiler can do one of these three things" and still been widely efficient
So, what’s that list for “write to a memory location outside allocated memory”?
That may corrupt some internal structure for a hard-disk, causing a loss of the entire file system if data is later flushed.
Worse, with memory-mapped I/O, that can trigger a change to an I/O pin, so it could conceivably launch an ICBM, starting world war three.
The best one probably could do “it may or may not perform that write, and the write may have arbitrary effects, not necessarily immediately”. Is that truly better than “undefined behavior”?