Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site toram.UUCP Path: utzoo!utcs!mnetor!toram!roe From: roe@toram.UUCP (Roe Peterson) Newsgroups: net.lang.c Subject: Re: Infinite loops Message-ID: <140@toram.UUCP> Date: Mon, 21-Apr-86 11:07:39 EST Article-I.D.: toram.140 Posted: Mon Apr 21 11:07:39 1986 Date-Received: Mon, 21-Apr-86 17:08:39 EST References: <577@ur-helheim.UUCP> Reply-To: roe@toram.UUCP (Roe Peterson) Organization: Toram/Globe-Tek Systems Ltd., Toronto, Canada Lines: 21 Summary: In article <577@ur-helheim.UUCP> badri@ur-helheim.UUCP (Badri Lokanathan) writes: >My question is the following: is there any reason (other >than personal preferance) why one would prefer to use any particular form? >I personally prefer the while(1) form since it seems to make better reading. >Even better, I sometimes define TRUE to be 1 and then use while(TRUE). 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. simply loops with no checks. -- Roe Peterson {linus,ihnp4,decvax}!utzoo!toram!roe All that glitters is spray-paint.