meaning of continue (WAS: Some interesting novice questions [...

John Stanley stanley at phoenix.com
Tue Oct 30 04:14:40 AEST 1990


rob at raksha.eng.ohio-state.edu (Rob Carriere) writes:
> 
> The fatality of course only applies to those of us who are allergic to
> anthropomorphisms.  The rest of us is fortunately able to use a very powerful
> mental tool. 

   No, the fatality applies to anyone who uses the powerful mental tool to
create extremely verbose, INCORRECT, confusing versions of computer
instructions. 

> So?  I would accept K&R or H&S quotes (for pre-ANSI C), or quotes from the 
> standard (for ANSI C).  Anything else is what the courts call hearsay.

   Who is H&S? They wrote C? I thought it was K&R. Anything but K&R or the
standard is hearsay. 

> >   Your definition is also wrong. K&R 2ed, p. 65, "continue ... causes
> >the the next iteration of the enclosing for, while, or do loop to begin."
> >It does not refer to "Hey, you! Try again", nor to "go to the bottom".
> 
> Please observe that K&R2 contradicts your previous authority...  Also please
> observe that the `definition' Mr. Winter supplied, while informal, will get a
> human code-executer to do the right thing.  

   Hmmm. Sorry. I thought the purpose of coding was to get a MACHINE to
do the right thing. I can misread code all day and do the right thing,
but if the computer doesn't it was all for naught.

   But you are right. K&R and Bolsky use different words. If I had had K&R
at my desk I would have quoted them first. If I still had a copy of the
standard, I would quote it. I still don't find anybody who defines
"continue" as "try to do it right this time". And note that Mr. Winter's
definition fails for "do ... while()" as the bottom of the loop is after
the condition test.  (Oho, you say. The loop ends BEFORE the while. If so,
the while would not be tested in the loop, and the loop would not exit.
Something that occurs on each pass through a loop is part of the loop.)

> Finally, one could define continu
> to mean that `execution continues with the test expression of the innermost
> enclosing loop'.  Would you claim this wrong because K&R2 does not refer to
> `test expression'?  In other words, your concept of correctness is flawed.

   One could define continue to mean "stop here. Pick up dirty clothing
from floor. Do laundry." If we are speaking C we should all use the same
definitions. 

   What happens in the case "for(i=0;;i++) {...}". There is NO test
expression. How do you continue with a test expression that doesn't exist?
(Oho, you say. Just skip it if it isn't there. Your definition doesn't say
that. K&R's didn't need to add words for special cases.) Or, better:

	for( i=0; ; i++ ) {
		/* some code to do something */
		if( 10 < i ) break;
		/* more code to do something else */
		if( 20 < j ) continue;
		/* even more code */
	}

Here the test expression is IN THE MIDDLE of the loop. Your definition:
jump to the test expression. Skip /* some code */. K&R: begin next
iteration, which includes the i++ and /* some code */.

   Remember, the definitions we put on computer language elements must be
clear yet flexible. If I wrote compilers, I would see the mandate that
continue jump to the condition test as a mandate for condition test. No
condition test, syntax error. Notice how long it took for X3J11 to create
a standard, and there are STILL questions and unclear areas.
> 
> Of all the engineering disciplines and all the `hard' sciences, Computer 
> Science is the only field where a significant fraction of the population 
> objects to anthropomorphisms.

   No. Chemistry, for one, does not try to force thought capability onto
molecules and atoms. Electronics does not. Nobody has EVER said to me
"the electrons in this AND gate see unfriendly electrons coming in both
entrances, so they run out the exit to get away." How do we explain the
NAND gate? Are the invaders suddenly friendly so the electrons that were
previously running away stay to have a party? If you were an electrical
engineer and you told your fellow engineers that was how you define the
AND gate, you better find a new job because you will never live it down.

   I have never had an electronics person tell me that it took time for
my soldering iron to get hot because "the iron is thinking about getting
hot." I have heard MANY supposedly computer literate people tell me that
it takes a while to process that data because "there is a lot of data for
the computer to think about." Why does it take so long for a chess
playing computer to make a move, sometimes? "Why, there are a lot of
moves to think about."

   In fact, most 'hard' sciences tend to deal with numbers. Numbers make
it very hard to anthropomorphize. Maybe if more computer 'scientists'
would STOP anthropomorphizing, the science would become one instead of
the art it is now.

   The original definition mentioned in this thread was wrong. It applied
too much human instinct (I am tired of typing anthropomorphism. Drat,
typed it again, anyway) to a simple machine command. It led to incorrect
understanding of what the command was supposed to do. That is the real
danger of anthro... -- misunderstanding of what is really happening. It
makes people think that machines think, too. That it really IS the
machine's fault when the computer printed check is wrong. When the phone
switching network malfunctions under a load of CCIS signalling messages.
When the Airbus 320 fly-by-wire directs the plane into the ground.

   Computers don't make mistakes. People who program them do. People who
program them incorrectly want you to think computers made the mistakes, so
they tell you that computers think. That they refer to each other as "Hey!
You!" That they "try to do it right". That it is nobody's fault when your
credit card bill is $1,000,000.  Who made the mistake? THE COMPUTER!

"Arinth is a beautiful planet." "Oh, have you been there?"
  "Yes, but not yet." The Doctor. (TB)



More information about the Comp.lang.c mailing list