‹ BackHN Continuity

Thread

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

173 points · 290 comments · ibobev

  1. oleganza · · focus · HN ↗
    Why is null-terminated C string considered a "billion dollar mistake", but UB isn't?
    1. Guvante · · focus · HN ↗
      Null terminated strings were an intentional compromise, known to be inferior for execution but superior for memory

      Null being an "allowed" value for pointers is the mistake e.g. what became nullptr. "Allowed" because garbage values are garbage.

      1. account42 · · focus · HN ↗
        Think of the alternative where we'd be dealing with endless issues because someone though 255 or 2^16-1 characters ought to be enough for everyone.
        1. cppcppcpp · · focus · HN ↗
          VB6 :)
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.