‹ BackHN Continuity

Thread

C++26: Trivial infinite loops are no longer undefined behaviour

173 points · 290 comments · ibobev

  1. Aardwolf · · focus · HN ↗
    > the implementation may assume any thread will eventually do one of the following: terminate, call a library I/O function, access a volatile glvalue, or perform a synchronization or atomic operation

    Why is that rule needed? I could make my for loop try to solve the halting problem and it'll never finish either, circumventing that rule

    1. mitxela · · focus · HN ↗
      So the compiler can merge two computation loops without proving termination.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.