🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1287

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

#1287
From: Blair P. Houghton
Date: Fri, 25 May 1990 18:02
22 lines
1546 bytes
In article <16725@haddock.ima.isc.com> karl@haddock.ima.isc.com (Karl Heuer) writes:
>In article <5897@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
>>If I were to write a compiler under K&R1 and provide a no-optimization mode,
>>`for(;;)' would be an unconditional branch and `while(1)' would compare 1 to
>>0 and then branch-if-unequal, because that's what the syntax implies.
>
>I suppose you would also compile `if (x==y)' into code that compares x against
>y, sets a temporary to either 0 or 1, and then compares that value against
>zero, right?

Yes.  Then I'd compile it with a `-O' flag and the computer
wouldn't even have to load x and y.  It would _know_ they're
unequal just by smelling them.

>Your statements are vacuously true, because according to your definitions,
>nobody has ever written a "non-optimizing" compiler.

Probably.  Everyone wants to be helpful.

				--Blair
				  "Gilligan, If you wanna help, don't help."
				  -The Skipper
Technical Details
Message-ID: <5908@buengc.BU.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!dali!rpi!bu.edu!buengc!bph
References: <5876@buengc.BU.EDU> <12955@smoke.BRL.MIL> <5879@buengc.BU.EDU> <12971@smoke.BRL.MIL> <5897@buengc.BU.EDU> <16725@haddock.ima.isc.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!dali!rpi!bu.edu!buengc!bph
From: bph@buengc.BU.EDU (Blair P. Houghton)
Newsgroups: comp.std.c
Subject: Re: for(;;) vs. while(1) is a draw
Message-ID: <5908@buengc.BU.EDU>
Date: 25 May 90 18:02:44 GMT
References: <5876@buengc.BU.EDU> <12955@smoke.BRL.MIL> <5879@buengc.BU.EDU> <12971@smoke.BRL.MIL> <5897@buengc.BU.EDU> <16725@haddock.ima.isc.com>
Reply-To: bph@buengc.bu.edu (Blair P. Houghton)
Followup-To: comp.std.c
Organization: Boston Univ. Col. of Eng.
Lines: 22