‹ BackHN Continuity

Thread

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

173 points · 290 comments · ibobev

  1. BobbyTables2 · · focus · HN ↗
    TLDR: For almost 1/6 of a century, the C++ standards broke the simplest infinite loop and only just recently fixed it.

    Idiots!

    Don’t they really that people write real programs to solve real problems? This isn’t a theoretical academic exercise!

    1. Sharlin · · focus · HN ↗
      The argument is that an infinite loop without side effects isn't a real program. It's not useful for anything except wasting cycles.
      1. lou1306 · · focus · HN ↗
        Yeah the argument here is clear, also rather silly. Either you must accept that your language allows for completely useless computation, or, if the compiler is so good at detecting "unreal programs" it should also refuse to compile them.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.