C++26: Trivial infinite loops are no longer undefined behaviour
Thread
Unofficial Hacker News client; not affiliated with Y Combinator.
C++26: Trivial infinite loops are no longer undefined behaviour
Unofficial Hacker News client; not affiliated with Y Combinator.
JoshTriplett · · focus · HN ↗
Insert screaming here.
An infinite loop, with no library calls whatsoever, gets a system call inserted. That's a horrible surprise waiting to happen.
The entire concept of the "forward progress guarantee" is broken. An infinite loop should compile to an infinite loop. Nothing more, nothing less.
marcosdumay · · focus · HN ↗
I think you are misinterpreting that. That phrase unambiguously says the loop is preserved on the final binary.
JoshTriplett · · focus · HN ↗
leni536 · · focus · HN ↗
fc417fc802 · · focus · HN ↗
You: But you only might be stabbed. It isn't required to happen only permitted.
leni536 · · focus · HN ↗