Path: csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Sat, 10 Jun 2017 01:24:42 -0500 From: Gareth Owen Newsgroups: comp.lang.c Subject: Re: memscan() function or equivalent References: <20170607154705.f161b2807eb2b1a8dc12d389@gmail.com> <12fb0e96-0ac3-442d-8d04-baaef4234a85@googlegroups.com> <20170607164800.a6fba9d07170ec5d056d25a0@gmail.com> <878tl3g5jw.fsf@bsb.me.uk> Date: Sat, 10 Jun 2017 07:24:42 +0100 Message-ID: <878tl0fjh1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:XAAkXHvxeV/ruokdY9xkwrmnntg= MIME-Version: 1.0 Content-Type: text/plain Lines: 23 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-70kZ9aBeXB4BEkNaZ70K6YfbpDw/LlyZ7Edv0Xfg8+tvkjMA8TgrpEuGG50ikc08PSauuR81fxelm+3!SfYl8cCCh2XW2zcALsEEo+PYbyt2oZYSWbwVudsVrJQVTE8v+k2zMPoVcv7DcD3RfPItq5s= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2347 Xref: csiph.com comp.lang.c:111917 Tim Rentsch writes: > Many years ago I took a course from Alan Perlis, who was at that > time a fan of APL (and also other things, I don't mean APL only). > Describing APL, a phrase he used that stuck in my mind is "all in > one fell swoop", talking about computation that is done using > array operations rather than looping. At first I didn't see what > he was getting at, but over time I started to see the value of > computing based on data rather than computing based on control > flow. My preference here for 'k += *s0 == c0;' is mainly an > outgrowth of that insight. I totally understand and respect this opinion -- and I definitely don't feel desperately strongly -- but offer the following rejoinder, courtesy of Don Knuth "Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do" k += (*s0 == c0) (and as I read it, your rationale for it) falls firmly in the former category.