HNHacker News
TopNewBestAskShowJobs

4dd3r

5 karma · joined January 15, 2012

submissionscomments
4dd3r··on When GOTO makes sense
I use goto all the time, but only for one coding pattern. It's a very powerful pattern, which allows me to do memory cleanup completely on a per-function basis:

int abc(void *ctx) { int rc = -1;

  if (outcome_of_first() != SUCCESS) {
    my_log(MY_LEVEL, "Log my error");
    goto over;
  }

  if (outcome_of_second() != SUCCESS) {
    my_log(MY_LEVEL, "Log my error");
    goto over;
  }

  ...

  rc = 0;
over: if (something_allocated != NULL) free(something_allocated);

  if (something_else_allocated != NULL)
    free(something_else_allocated);

  return rc;
}
4dd3r··on 49% of UK get less than average broadband speed.
haha - this is classic!
4dd3r··on Twitter will exceed 500 million users on Wednesday
That's true. They have managed boost it in the past two years, but the amount of active users are still only in the region of 100 - 150 million.
4dd3r··on How to act against ACTA
My (slightly altered) version: http://nul.co.za/freedom.txt