Messages in this thread | | | Date | Fri, 18 Jun 1999 19:30:01 +0200 | From | Jamie Lokier <> | Subject | Re: oom() _still_ killing init |
| |
Last time I checked GCC, your proposed style generated worse code -- it had branches in the fast path and extra tests.
[And it's ugly IMO]
-- Jamie
Oliver Xymoron wrote: > foo(<vars>) > { > .... > if(something_bad) > goto fail; > .... > fail: > /* do cleanup */ > } > > ...with lots of failure modes. These can be trivially transformed to: > > foo(<vars>) > { > int cleanup_var; > > if(!bar(<vars>,&cleanup_var)) > /* do cleanup */ > } > > int bar(...) > { > int local_vars_we_don't_need_to_clean_up; > ... > if(something_bad) > return 0; > ... > > return 1; /* success */ > } > > Throw inline in front of foo_attempt() and you do away with the call > overhead. I'm not presenting this as an ideal approach, just an existence > proof that eliminating gotos is not necessarily hard, nor need it result > in ridiculous nesting. It may in fact result in smaller and simpler > functions.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |