‹ BackHN Continuity

Thread

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

173 points · 290 comments · ibobev

  1. kazinator · · focus · HN ↗
    I'd much rather have the compiler diagnose an infinite loop than silently pretend that it's not reachable, or that it can be rewritten to a yield.

    In other words, I am mentally well.

    1. WalterBright · · focus · HN ↗
      There's no way for a compiler to reliably determine that a loop is infinite, making it very difficult for the standard to require such determinations.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.