Deutsch English Français Italiano |
<v3mjlg$bpds$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: David Brown <david.brown@hesbynett.no> Newsgroups: comp.lang.c Subject: Re: C23 thoughts and opinions Date: Tue, 4 Jun 2024 10:36:00 +0200 Organization: A noiseless patient Spider Lines: 52 Message-ID: <v3mjlg$bpds$2@dont-email.me> References: <v2l828$18v7f$1@dont-email.me> <20240602124448.704@kylheku.com> <864ja9ojit.fsf@linuxsc.com> <v3lb0u$2452$1@dont-email.me> <v3ldn7$1pr90$1@news.xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 04 Jun 2024 10:36:01 +0200 (CEST) Injection-Info: dont-email.me; posting-host="7740955b17fd8df0cccaba227b9e3b39"; logging-data="386492"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cP6iAXPL/9w3SDDUACVWvMk41zJCbxqo=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cancel-Lock: sha1:akxle1jioT0Obx5UZBHNjTyM0a8= Content-Language: en-GB In-Reply-To: <v3ldn7$1pr90$1@news.xmission.com> Bytes: 2842 On 03/06/2024 23:48, Kenny McCormack wrote: > In article <v3lb0u$2452$1@dont-email.me>, > Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote: >> On 6/3/2024 1:31 PM, Tim Rentsch wrote: >>> Kaz Kylheku <643-408-1753@kylheku.com> writes: >>> >>>> On 2024-06-02, Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote: >>>> >>>>> I've always considered >>>>> for (;;) >>>>> preferable over >>>>> while (1) >>>> >>>> Of course it is preferable. The idiom constitutes the language's direct >>>> support for unconditional looping, not requiring that to be requested by >>>> an extraneous always-true expression. >>>> >>>> Using while (1) or while (true) is like i = i + 1 instead >>>> of ++i, or while (*dst++ = *src++); instead of strcpy. [...] >>> >>> Using for (;;) for an infinite loop is an abomination. Anyone >>> who advocates following that rule is an instrument of Satan. >> >> Better than goto? ;^D > > I can't believe we're still having this conversation. > > Surely, on any reasonably modern compiler, all three forms will generate > exactly the same code. > I would think so, yes. (I've used toolchains where that was not true, but they are firmly in my past.) But conversations - arguments - about style of source code /never/ get out of date! Personally, I'm in the "while (true) { ... }" camp. To me, "for (;;)" looks like a weird smiley, and I do not fall for any appeals to Deniis Ritchie's authority. But we are missing another option: void mainloop() { // do something mainloop(); } That should be fine with an optimising compiler.