[Dnsmasq-discuss] goto's to the middle of if's in tftp.c...
Joshua J. Kugler
joshua at eeinternet.com
Thu Feb 1 19:16:44 GMT 2007
On Thursday 01 February 2007 07:51, Simon Kelley wrote:
> Carlos Carvalho wrote:
> > There are some goto's to the middle of if's and else's in tftp.c. Such
> > jumps could perhaps be changed to a place less susceptible to
> > confusion... Since it's a new piece of code it might still be open to
> > small revisions. It may cost some extra if's but it won't make a
> > difference in performance.
>
> If anyone can come up with a nicer solution, I'd be happy to take it,
> but I think that's a good use for gotos. The code identifies a couple of
> error conditions and the way to handle them, so it's obvious what's
> going on. When the same error conditions are encountered later, they are
> handled by gotos to the previously defined error handling code - it's a
> standard programming practise.
<joking>
I got a solution!! Rewrite the whole thing in C++ and use exceptions! That's
it!
</joking>
Actually, now that I think about it, how "ugly" would it be to compile the C
code with a C++ compiler and just use C++ features where they make sense
(i.e. exceptions instead of goto's)?
j
--
Joshua Kugler
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111
More information about the Dnsmasq-discuss
mailing list