At 12:03 PM 2/26/2010, Chuck Guzis wrote:
On 26 Feb 2010 at 12:46, Dave McGuire wrote:
On Feb 26, 2010, at 12:38 PM, Brent Hilpert
wrote:
> When I was writing lots of C code in the 80's, I used goto's quite
> regularly (I can hear the shrieks! and gasps! and jaws hitting the
> floor out there, or perhaps not from this audience).
Every programmer I've ever known when faced with a blackboard or
whiteboard and asked to describe the operation of a program starts
out by drawing a box and filling it with text. Then another...
Every good cartoonist knows you draw the words first, then put the box around them.
Speaking of loops, this topic was covered in 1999 and 2005.
- John
At 10:12 AM 5/11/2005, Vintage Computer Festival wrote:
I miss GOTO. It was unnecessarily expunged from the
programmmer's toolbox
by elitist academics.
It's a tool. Why, I discussed this with a "Sam Ismail" back in 1999:
- John
Date: Fri, 15 Jan 1999 16:00:07 +0000
To: classiccmp at
u.washington.edu, <dastar at ncal.verio.com>
From: John Foust <jfoust at threedee.com>
Subject: Re: Computers for children
At 11:37 PM 1/14/99 -0800, Sam Ismail 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.
[...] but C really suffers from a lack of
a general error trapping mechanism that one can invoke to break out of
loops as required. Sometimes I think goto's are the answer but I can
never find an appropriate way to implement it.
I use "goto" in C on a regular and consistent basis for error exceptions:
USHORT firstFunction( void )
{
USHORT lerr;
if ((lerr=secondFunction()) != TE_NOERROR) {
goto out;
}
out:
return lerr;
}
The benefit is that all functions propogate an error code, any
function can fail, and all functions clean up after themselves
after their "out" label.
- John