Article View: comp.std.c
Article #1280Re: for(;;) vs. while(1) is a draw
From: Mark Brader
Date: Fri, 25 May 1990 18:59
Date: Fri, 25 May 1990 18:59
20 lines
1271 bytes
1271 bytes
> > 1 certainly is "logical" ... > "true" is logical. "1" has to be explained as a special quirk of C. Either "while(1)" or "while(TRUE)" requires, if not explanation, at least a moment's thought on first encounter, because the reader has to think about which way the degenerate test goes. What better way to express the absence of a test than by omitting the test from the statement? (That C allows "for(;;)" and not also "while()" is presumably a historical accident. "while()" looks like a function call, but so does "while(x)".) But if you think "while(1)" is more readable, well, you write it that way. Just like brace styles, it's not worth fussing about. -- Mark Brader "It's simply a matter of style, and while there SoftQuad Inc., Toronto are many wrong styles, there really isn't any utzoo!sq!msb, msb@sq.com one right style." -- Ray Butterworth This article is in the public domain.
Technical Details
Message-ID:
<1990May25.185950.12996@sq.sq.com>Path:
arc1-ca.pugleaf.net!utzoo!sq!msbReferences:
<12971@smoke.BRL.MIL> <5897@buengc.BU.EDU> <12986@smoke.BRL.MIL>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!utzoo!sq!msb From: msb@sq.sq.com (Mark Brader) Subject: Re: for(;;) vs. while(1) is a draw Message-ID: <1990May25.185950.12996@sq.sq.com> Organization: SoftQuad Inc., Toronto Canada References: <12971@smoke.BRL.MIL> <5897@buengc.BU.EDU> <12986@smoke.BRL.MIL> Date: Fri, 25 May 90 18:59:50 GMT Lines: 21