• bss03@infosec.pub
      link
      fedilink
      English
      arrow-up
      4
      ·
      4 days ago

      Java doesn’t allow goto, but specifically does have labels for labeled break/continue to support the multi-loop exiting case.

      I imagine these two “structures” will always be implemented in C source through disciplined use of goto.

      • Gladaed@feddit.org
        link
        fedilink
        arrow-up
        5
        arrow-down
        1
        ·
        4 days ago

        It’s literally the only way to do this. Other ways include checking of loads of bools. That’s slow.

        • bss03@infosec.pub
          link
          fedilink
          English
          arrow-up
          3
          ·
          4 days ago

          In C maybe. In language that support proper recursion schemes, the apomorphism models the early-exit loop.

    • ZILtoid1991@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      4 days ago

      I also use it for avoiding recursive function calls. In theory, this will tell the compiler to just ditch the current stack and go back to the beginning of the function.