Re:C – Preliminary C2x Charter
by mikeash on Thursday March 17, 2016 @11:43AM
(#11305062)
Because it's often either like this:
Or like this:
[ Parent
| on HN ]
Someone mentioned this instead:
while (true) {
const bool flag = do_something();
if (!flag) break;
}
Is it not what grandparent wanted?Yes, that would do it. It would just be nice to have it be better supported in the language rather than working around it like this. Any time you introduce break or continue into a loop you're making it more difficult to follow what's going on, since suddenly the exit condition can be anywhere. Not a big deal, especially if there's only one and it's right at the end, but mildly annoying that it can't be expressed more naturally.