Re:Three new utility functions in C++23
by CJefferson on Wednesday November 09, 2022 @02:24PM
(#33536580)
Technically these would still produce different results if y started two bytes after x -- I can't remember if that is itself legal however!
Re:Three new utility functions in C++23
by gpderetta on Wednesday November 09, 2022 @03:45PM
(#33537580)
No that wouldn't be legal. Distinct objects can't partially overlap, unless one is a subject of the other.
Re:Three new utility functions in C++23
by gpderetta on Wednesday November 09, 2022 @03:48PM
(#33537609)
Attempting to emulate restricted with __builtin_unreachable has been one of the first thing I tried when I learned about unreachable. I periodically try again, but generally I have been underwhelmed with trying to give gcc value range informations with it.
One example was interesting, though. I could see someone believing these might produce the same optimized assembly (-O2):
However, it produces: Is this something compiler contributors would optimize once they know about it? Similar question probably exists with using `__builtin_unreachable` if values aren't aligned versus `__builtin_assume_aligned`.I'd love to see these things illustrated with more real-world examples.