On Jan 16, 3:05, Sean 'Captain Napalm' Conner wrote:
> Remember, C has a goto statement, although I
don't think in my nearly
10
> years of C programming I've ever used it,
although on certain rare
> occasions it seemed the easy way out to a sticky coding problem.
I think I've used it once -- and then removed it again.
Perhaps it's my own biases here (coming with 9
years of solid C coding)
but if you have more than one conditional test in an `if' or `while'
statment, you may be doing something wrong. Also, if you're so deeply
nested that you need a `goto' to get out of trouble, then again, you may
be
doing something wrong. If you are nested about four
levels deep in a
function, you may be doing something wrong. Don't be afraid to use lots
of
functions, each doing one thing and one thing only.
This applies to any
language really.
This is definitely off-topic (who was that said I was single-minded?) but
for a fine example of bletcherousness, try the source to the pine mailer
(here also known as pain, or Pain In Neck Email). Find the 70K source file
that handles the main mail stuff, and try 'grep goto' - and watch three or
four screenfulls scroll by. All in one function (the 70K file is almost
all one function).
--
Pete Peter Turnbull
Dept. of Computer Science
University of York