3 ms·
> Even specifying that they have a new arbitrary value on each access would be a big improvement over the status quo. This is approximately what LLVM describes
by Gankro 11y ago
> Even specifying that they have a new arbitrary value on each access would be a big improvement over the status quo.
This is approximately what LLVM describes undef as, and it indeed leads to nasal demons. This description enables a single value to both pass a bounds check, and then subsequently go out of bounds!
- Dylan16807 11y agoYou're right, in certain cases it would still cause trouble, but it would be a lot fewer cases than 100%. Reading only once would be safe, and passing it to another functions would make a variable that can no longer change unexpectedly.
- dbaupp 11y agoUnless the function is inlined/the compiler can deduce that the variable is undef. (Of course, you could define it to work, but I would suspect that would make this sort of value much less useful.)