News for hackers. Stuff that matters.
Re:Yoda conditions by Izkata on Thursday August 15, 2019 @11:50AM (#20706262)
And this introduces another bug: it'll run the loop body even if syscall fails the first time it's run.
Re:Yoda conditions by dpzmick on Thursday August 15, 2019 @10:16PM (#20711575)
I've been going with this style for things like reading files (with retries) or any sort of loop that feels awkward.

  while (1) {
    int ret = ...;
    if (ret == ...) break;
    if (ret == some_other_condition) break;
    // additional termination conditions....
    // do exactly one thing
  }