‹ BackHN Continuity

Thread

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

173 points · 290 comments · ibobev

  1. account42 · · focus · HN ↗
    Unfortunate. There isn't ever a good reason to have an infinite loop so concerned compilers could have just diagnosed this as a warning.
    1. sumtechguy · · focus · HN ↗
      > There isn't ever a good reason to have an infinite loop

      That seems to be a very broad statement. For example in a system where interrupts mostly control things this sort of 'do not close the program' could be useful.

      A guy I worked with had one I never would think of because I do not work in that field.

      But yeah a warning would probably be useful.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.