Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!husc6!harvard!seismo!rlgvax!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: net.lang.c Subject: Re: Infinite loops Message-ID: <390@hadron.UUCP> Date: Sat, 3-May-86 10:54:10 EDT Article-I.D.: hadron.390 Posted: Sat May 3 10:54:10 1986 Date-Received: Tue, 6-May-86 06:06:11 EDT References: <117@brl-smoke.ARPA> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Organization: Hadron, Inc., Fairfax, VA Lines: 27 Summary: Use for (;;) ... In article <117@brl-smoke.ARPA> gwyn@BRL.ARPA (VLD/VMB) writes: >do ... while(1); >while(1) ... >for(;;) ... >are all widely-used idioms for unconditional looping in C. >I personally prefer the latter, but the choice is just a >matter of taste. Any reasonable compiler will generate >efficient code for all three constructs. Unfortunately, as I'm sure many readers of this group will agree, not all compilers are reasonable. The only one that consistently doesn't generate useless code is for (;;) {...}. BTW, given all these defines: here are some "cute" ones of mine: #define ever (;;) /* for ever ...; */ #define unless(x) if (!(x)) /* unless (x) ...; */ #define until(x) while (!(x)) /* until (x) ...; do ... until (x); */ and of course [ given #define OK 0 ] #define streq(a,b) (strcmp(a, b) == OK) #define strneq(a,b,n) (strncmp(a, b, n) == OK) -- Joe Yao hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}