Re: two xasserts in squid3

From: Amos Jeffries <squid3@dont-contact.us>
Date: Mon, 11 Feb 2008 15:34:03 +1300 (NZDT)

> 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
Received on Sun Feb 10 2008 - 19:34:06 MST

This archive was generated by hypermail pre-2.1.9 : Sat Mar 01 2008 - 12:00:09 MST