> On Mon, Feb 11, 2008, Amos Jeffries wrote: > >> FWIW the keyword 'typedef' is as evil in C++ as #define, and only 'goto' >> is worse (and completely unnecessary since functional-C deprecated >> pascal). > > Goto is fine. You just need to know how and when to use it. > > My use of goto in new Squid C code I write is purely to unwind whatever > stuff has been allocated/locked in the function before I exit. That way > I end up with -one- exit location in the function and I don't have to > bum around using extra functions or massively nested conditional > constructs to achieve it. In fact, I've used goto in a few places to > tidy up the code..
If you need to use it to clean up a single function. It's an obvious sign that the function is too complicated. In 10 years of writing complicated code I have yet to see a single place where it is actually required. Amos