Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-tgr!ron From: ron@brl-tgr.ARPA (Ron Natalie) Newsgroups: net.lang.c Subject: Re: for <==> while (an exception) Message-ID: <11608@brl-tgr.ARPA> Date: Mon, 15-Jul-85 18:25:56 EDT Article-I.D.: brl-tgr.11608 Posted: Mon Jul 15 18:25:56 1985 Date-Received: Thu, 18-Jul-85 03:02:43 EDT References: <200@ur-cvsvax.UUCP> <314@dcl-cs.UUCP> Distribution: net Organization: Ballistic Research Lab Lines: 13 > Here's another ... > An infinite "for" loop is given by "for (;;) statement". The equivalent > "while" expression is, logically, "while () statement". As this fails to > compile, one has to resort to "while (1) statement"; which is less efficient > in most cases as code is generated to test if "1" equals "0". MYTH! MYTH! (yeth thailor) most of the popular compilers will evaluate constant expressions and not test them explicitly. The 4.2 compiler even knows enough to tell me that if I don't have an exit from the while(1) loop, that the further statements are not reached. It, in fact, generates the same code for either of the infinite loop cases. -Ron