3 ms·
All the crazy crap they added to C/C++, how was named loops and corresponding named break/continue not one of them?
by Pxtl 13y ago
All the crazy crap they added to C/C++, how was named loops and corresponding named break/continue not one of them?
- tspiteri 13y agoIn this case, the goto is into the loop, not out of it, so named break/continue would not help. And the only point of having named break/continue would be to not use goto. I don't see the point in that, since to me, this: for (i = 0; i < ie; i++) { continue_i: for (j = 0; j < je; j++) { if (cond1) goto break_i; if (cond2) goto continue_i; /* ... */ } } break_i: is as readable as this: loop_i: for (i = 0; i < ie; i++) { for (j = 0; j < je; j++) { if (cond1) break loop_i; if (cond2) continue loop_i; /* ... */ } }