‹ BackHN Continuity

Thread

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

173 points · 290 comments · ibobev

  1. bitbasher · · focus · HN ↗
    If an infinite loop can be both:

    1. An infinite busy loop.

    2. A thread yield/sleep.

    It is by definition undefined behavior. You don't know what you're going to get!

    1. mwkaufma · · focus · HN ↗
      If it's one of those two it's not fully undefined behavior it's just implementation defined. UB can do anything.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.