News for hackers. Stuff that matters.
Re:C – Preliminary C2x Charter by alexhutcheson on Thursday March 17, 2016 @11:26AM (#11304909)
For your first case, why not:

  do {
  } while(!do_something());
Not trying to be snarky, I'd just like to understand :)
Re:C – Preliminary C2x Charter by mikeash on Thursday March 17, 2016 @11:43AM (#11305062)
Because it's often either like this:

    do {
      const bool flag = do_something();
      do_something_else();
    } while(!flag);
Or like this:

    do {
      int whatever = get_some_data();
      const bool flag = do_something(whatever);
    } while(!flag);
Re:C – Preliminary C2x Charter by p1esk on Thursday March 17, 2016 @06:32PM (#11308171)
Someone mentioned this instead:

  while (true) {
    const bool flag = do_something();
    if (!flag) break;
  }
Is it not what grandparent wanted?
Re:C – Preliminary C2x Charter by mikeash on Friday March 18, 2016 @09:25AM (#11311595)
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.