Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!pyramid!pesnta!amd!amdcad!lll-crg!seismo!brl-sem!ron From: ron@brl-sem.UUCP Newsgroups: net.lang.c Subject: Re: Infinite loops Message-ID: <185@brl-sem.ARPA> Date: Tue, 29-Apr-86 16:10:21 EDT Article-I.D.: brl-sem.185 Posted: Tue Apr 29 16:10:21 1986 Date-Received: Sat, 3-May-86 18:07:49 EDT References: <577@ur-helheim.UUCP> <140@toram.UUCP> Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 12 > Unless you have a very unique optimizer, it is usually better to use the > for(;;) form rather than the while(1) form. Reason is: while(1) is > ALWAYS evaluated (ie. : is 1 TRUE? if so, continue) before each iteration, > whereas for(;;) compiles as a simple branch or jump instruction with no > test and no conditional branch. > Crapola. All the PCC impementations I've checked don't test the constant even when you don't turn the optimizer on. Our old PDP-11 Ritchie compiler does generate the test, but the standard -O optimizer removes it. Nothing unique here. -Ron