News for hackers. Stuff that matters.
Re:Ask HN: How do you define a junior developer? by tzs on Thursday September 22, 2016 @01:32PM (#12558539)
Of course in this case you can avoid both the repetition and the goto at the cost of more nesting:

  rv = -1;
  a = open(...);
  if (a) {
    b = open(...);
    if (b) {
      c = open(...);
      if (c) {
        rv = something(a,b,c);
        close(c);
      }
      close(b);
    }
    close(a);
  }
  return rv;
I wonder if there is some sort of program organization analog of Heisenberg's uncertainty principle, where the product of some measure of repetition, some measure of non-structured jumping, and some measure of nesting must be greater than a certain value?

There are no comments on this comment yet.