Path: csiph.com!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.programming Subject: Re: true loop Date: Thu, 13 Sep 2012 10:22:03 +1200 Lines: 35 Message-ID: References: <504FC54B.7D2@mindspring.com> <5875d198-0e6b-4075-94a0-d7c56a9a4386@gq8g2000vbb.googlegroups.com> <505106D1.10CD@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net Q/KazHZHYB4GZtmIPbTIfA+cwU/+i4p7EKmwv9i986qJmiCsnmPCcuBcpGjyOlAj2y Cancel-Lock: sha1:LQ4SO6XMDrlhW9G/bbDV4tzrB2I= User-Agent: Mozilla/5.0 (X11; SunOS i86pc; rv:12.0) Gecko/20120423 Thunderbird/12.0 In-Reply-To: <505106D1.10CD@mindspring.com> Xref: csiph.com comp.programming:2203 On 09/13/12 10:04 AM, pete wrote: > Nick Keighley wrote: >> >> On Sep 12, 12:12 am, pete wrote: >>> bob wrote: >>> >>>> Is it considered bad practice to do something like this? >>> >>>> while (true) >>>> { >>>> ... >>>> } >>> >>> Th C compiler which I use, >>> issues a warning for that. >>> >>> In C, >>> for(;;) >>> is for writing that kind of loop. >> >> in what sense is it "for writing that kind of loop"? > > In the sense that it is only only loop style, > which is explicitly described by the guy who invented it, > as being an "'infinite' loop", in both editions of K&R. > > It's also the loop style > which is used for all of the examples of "infinite" loops, > in the C standard. Possibly because C started life without a boolean type. I doubt you would see the for idiom used very often in other languages. -- Ian Collins