Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Comma operator in for() statements Date: Mon, 23 Mar 2020 21:11:37 -0700 Organization: None to speak of Lines: 25 Message-ID: <87sghypf2e.fsf@nosuchdomain.example.com> References: <4fbkkg-2kr1.ln1@mail.home.palmen-it.de> <4fa819d5-bc63-4c81-bc3f-b328dfc0008a@googlegroups.com> <1a9cdf79-5489-43d0-a050-888012804ca2@googlegroups.com> <87zhc72f0u.fsf@bsb.me.uk> <6ed3fe7f-aa6e-41b7-9753-285b616c2cf4@googlegroups.com> <87eetirfyb.fsf@nosuchdomain.example.com> <871rpirdt3.fsf@nosuchdomain.example.com> <5788dcca-ca28-4fb4-b454-89436c601d0c@googlegroups.com> <87wo7aps7r.fsf@nosuchdomain.example.com> <92746830-1308-4529-8384-853d94774550@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="cddcfdf96fa244ceeb789ef1142863d8"; logging-data="6965"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PioGKRRx9CK4qsHfrvEIn" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cancel-Lock: sha1:c5apKcnJBbCX3rvNmZwbMWbNGuM= sha1:2otZo+7WQokareS75uBNlvILBzs= Xref: csiph.com comp.lang.c:150791 Malcolm McLean writes: [...] > The ship has sailed, and now you'd have to support old style for loops > for a very long time, for backwards compatibility. Probably pretty much forever, or at least as long as the language can reasonably be called "C". Removing C's existing for loop is just not a possibility. I was talking only about the possibility of adding a more restricted loop construct. C++'s range-based for statement might be an inspiration (of course C still fully supports the existing for statement it inherited from C). > But if we were > designing C from scratch, we could reasonably have a less flexible > for loop. If people want complex conditions rather than simple iteration, > usually over an array, they can use "while". I disagree. The flexibility of C's existing for loop is an advantage. [...] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */