3 ms·
It is more that while we can define everything, there are costs. I can track every allocation in a hidden table, then before following a pointer verify that t
by bluGill 4y ago
It is more that while we can define everything, there are costs. I can track every allocation in a hidden table, then before following a pointer verify that the point being followed is in the table. However that is extremely expensive (don't forget that you might follow a pointer in one thread while a different thread deletes it, so there is a complex race condition logic needed here that is tricky to get right)
By making things undefined we can avoid a large amount of complex code to detect a situation that shouldn't happen.
- kaba0 4y agoExactly. While it is definitely harder with a low-level language, it is absolutely doable in terms of costs with managed languages. In Java for example even data races are well-defined to a degree (and OCaml’s new multithreaded mode defines data races with even bigger guarantees)