Deutsch English Français Italiano |
<v3ltlr$48om$16@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro <ldo@nz.invalid> Newsgroups: comp.lang.c Subject: Re: C23 thoughts and opinions Date: Tue, 4 Jun 2024 02:20:43 -0000 (UTC) Organization: A noiseless patient Spider Lines: 26 Message-ID: <v3ltlr$48om$16@dont-email.me> References: <v2l828$18v7f$1@dont-email.me> <v2o57g$1t5p4$1@raubtier-asyl.eternal-september.org> <v3dkgh$2e0me$1@dont-email.me> <v3gou9$36n61$3@dont-email.me> <v3hrq7$1o743$1@news.xmission.com> <v3i7u3$3bp0v$1@dont-email.me> <20240602124448.704@kylheku.com> <v3lgti$325i$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 04 Jun 2024 04:20:44 +0200 (CEST) Injection-Info: dont-email.me; posting-host="d7d916175bb629e2353c22c0a9deb72e"; logging-data="140054"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199vwe5TWjL/w882TT3/WRI" User-Agent: Pan/0.158 (Avdiivka; ) Cancel-Lock: sha1:vi1NF9VL+NYu5KgyLMCLwUOmB2A= Bytes: 1983 On Mon, 3 Jun 2024 23:43:00 +0100, bart wrote: > All that suggest sto me is that the language *needs* an explicit endless > loop! I agree. Also it is common for a loop to have multiple exits, and I don’t like treating one of them as a special “termination condition” above the others, so I like to use “break” for all of them. The “for” form not only caters for this, it allows handy initialization of local variables that keep their value between loop iterations. E.g. for (unsigned int i = length_of(array);;) { if (i == 0) { ... not found ... break; } /*if*/ --i; if (... array[i] matches what I want ...) { .. found ... break; } /*if*/ } /*for*/