Name: Anonymous 2010-09-13 16:49
...is my real homeboy.
Edsger Dijkstra is flawless and sometimes I wish /prog/ could understand him.
Edsger Dijkstra is flawless and sometimes I wish /prog/ could understand him.
goto mostly for this kind of thing:/* ... */
if (!(ptr = malloc (size)) goto fail_malloc;
if (!(fh = fopen (some_file))) goto fail_fopen;
if (some_other_thing_that_can_fail (foo) != bar) goto fail_some_more;
/* ... */
return success;
fail_some_more:
fclose (fh);
fail_fopen:
free (ptr);
fail_malloc:
clean_up (previous shit);
return failure;