12 Jul
2017
12 Jul
'17
4:50 p.m.
Groke, Paul wrote:
No, the problem with this code is (realistically speaking) not aliasing, it's object lifetime. I don't think that any compiler is so strict as to break it though; not yet, and maybe not ever.
Isn't that kind-of the same thing?
Kind of. The undefined-ness comes from two separate places in the standard, so it's not the same in theory. And it's not the same in practice in general (although not here) because we don't want accesses to our fake size_t to alias everything in the universe, as this would cause spills and reloads and would defeat the optimization.