Comment by bathtub365
3 hours ago
Who actually considers a loop a branch? A loop is a chunk of code that will be run N times depending on some evaluation that’s run before or after an iteration. A branch is a single decision which of several pieces of code to run, once.
https://godbolt.org/z/rz8MxhdGd
Just a simple example, but the conditional branch occurs on line 14 of the generated assembly. It does a comparison (line 13) and then a conditional jump (jl, line 14).
> Who actually considers a loop a branch?
interesting question...
> A loop is a chunk of code that will be run N times depending
oh! turns out you do!
> Who actually considers a loop a branch?
A loop contains a branch - keep looping or break. At least according to structured programming -- https://en.wikipedia.org/wiki/Structured_program_theorem.
>Who actually considers a loop a branch?
The machine?