Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Comma operator in for() statements
Date: Thu, 02 Apr 2020 19:20:20 -0700
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <865zehpaxn.fsf@linuxsc.com>
References: <1NIdG.90366$0hk.19720@fx08.am4> <0fc029c2-7036-4ca9-86af-15913f874a08@googlegroups.com> <20200324202535.68c64bb9be8f95153b947f4b@g{oogle}mail.com> <878sjp1gk1.fsf@bsb.me.uk> <20200325145934.5f39e56fc029b19da139cc0d@g{oogle}mail.com> <86r1xd97wn.fsf@linuxsc.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="764a289b4fffae23755ccdbd2c0254f8"; logging-data="17123"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+tJ9oUml5sS3gDigIhSRE2vc+AYuKfS9c="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:OEzYb1dwwVfkYaakrjgG74n22NI= sha1:rCkHcmYymauoCNNW2G6me6OcStk=
Xref: csiph.com comp.lang.c:150968
Bart writes:
> On 27/03/2020 14:42, Tim Rentsch wrote:
>
>> Anton Shepelev writes:
>>
>>> One of the worst abuses of `while' is code for which many
>>> programmers praise C:
>>>
>>> char *s, *d;
>>> /* ... */
>>> while (*d++ = *s++);
>>>
>>> It employs several means of obfuscation:
>>>
>>> 1. loop-control statements with side effects,
>>>
>>> 2. use of counter-intuitive post-increment operator on
>>> both parts of an assibnment.
>>>
>>> 3. confusion of logical condition and comparison with
>>> zero.
>>>
>>> 4. an empty body of the `while' statement.
>>
>> It's idiomatic C. Perhaps more importantly, C not only allows
>> such constructions but embraces them stylistically. Such things
>> have been part of C since its earliest beginnings. If someone
>> wants to write Pascal-style code they should write in Pascal.
>
> What happened to writing code in the clearest manner and leaving it
> to the compiler to optimise?
Sure, but where do you draw the line?