for(;;) vs. while(1) is a draw

Blair P. Houghton bph at buengc.BU.EDU
Thu May 31 01:20:41 AEST 1990


In article <4298 at castle.ed.ac.uk> aipdc at castle.ed.ac.uk (Paul D. Crowley) writes:
>bph at buengc.bu.edu (Blair P. Houghton) sez in <5915 at buengc.BU.EDU>
>>	V ARIRE FNVQ VG QVQ, LBH BOFGERCREBHF SHPXVAT NFFUBYR!!!

>Blair, you're way out of line posting this on comp.std.c.   Take insults
>to alt.flame.

I thought I had; or at least crossposted.

I do apologize to most of you, at least the ones who haven't
continually misinterpreted what I've been saying.

>In any case, you definitely seemed to imply that you were talking about
>code.  Consider:

It seems to have been taken that way, and I was talking about
code as an end-product, but I didn't anywhere leave lying
around the idea that the standard refused to allow
optimizations, disoptimizations, or even the generation of
player-piano rolls (as long as they handle their input and
produce their output correctly) from conforming programs.
In fact, I stated several times that it didn't.  I quoted
the section mooting optimization.  I made it so clear that
I understood and wanted to make it understood that a compiler
was free to optimize that when people kept ignoring those
clarifications I could only assume that they were either
mentally deficient, incomprehending, or just being malicious.

>* You raised the issue because the standard states that for(;;) means
>for (;1;) which you said meant that it could be no more efficient than
>while(1).  Since everybody already knew they were identical in meaning,
>seems to me all you can be talking about is the efficiency of the code
>generated.  In other words, the standard specified that the _code_
>_generated_ must have an extra comparison.

Now _you're_ missing the condition that the implementor's
implied that it's not optimizing.  If it has, then your
last statement should be true.  If it hasn't, that statement
may or may not be true.

>* If you're not worried about the code generated so long as it does what
>the standard says it should, why the hell were you complaining about
>"optimization without your permission"?

Because I don't like compilers that get ahead of my debugging.
When the time comes to make the object code tiny and quick, it
will have at least been confirmed logically (to some level
of satisfaction).

>* I seem to remember your saying that a compiler which didn't produce
>the same code for these two cases would be breaking the law, if it
>claimed to adhere to the ANSI standard.

It also had to claim to eschew all forms of optimization.

>Blair, people are wrong all the time.  No doubt Doug and Gwyn often make
>mistakes.  Why can't you say "Oh, yes, mea culpa" and keep quiet instead

I did say exactly that when someone (you?  Karl Heuer?  Someone else?)
pointed out that K&R1 actually did explicitly state that the second
expression in an empty-for was to be replaced by a `1'.  I've NEVER
tried to hide my mistakes.  Go ahead and prove me wrong.  I'll applaud
you for it.

>of denying you ever said that (praying that no-one can be bothered to
>dredge up the relevant articles) and flaming the people kind enough to
>point it out?

Because this is not a mistake.  I was very careful to say what I
meant to say and they repeatedly ignored the first half of my
arguments.  You may think that anger and profanity have no place
in reasoned debate, and I agree, but when people drop half of the
reason the rules (explicit or otherwise) of the debate become moot.

				--Blair
				  "To live a sheltered
				   life is to waste it."



More information about the Comp.std.c mailing list