Hacker News new | ask | show | jobs
by kazinator 2743 days ago
> the break statement branches to the bottom, and then there is third branch to get back to the top of the while loop

That suggests your C compiler isn't doing jump threading: replacing the jump to an unconditional jump instruction with a direct jump to that instruction's destination.

That's a very basic optimization I might expect even from a C compiler written in 1980.

1 comments

> That suggests your C compiler isn't doing jump threading

And even if he has such a compiler (which is doubtful) he doesn't have to put the "break" in the switch! He can write continues, e.g. this:

        switch ( i ) {
        case 3:
            i = 7; continue;
        default:
            continue;
        }
is valid C, and specifies explicitly that the next loop pass is expected.