Path: csiph.com!weretis.net!feeder4.news.weretis.net!border2.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!buffer2.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Wed, 14 Jun 2017 13:56:07 -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> <878tl0fjh1.fsf@gmail.com> <87efupaz5e.fsf@gmail.com> Date: Wed, 14 Jun 2017 19:56:07 +0100 Message-ID: <874lvi4cvs.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:YkZLAEZYDIvwWGaDyiHrNIIClo0= MIME-Version: 1.0 Content-Type: text/plain Lines: 47 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-1uAr/8ghK3JeN9ABLA6fH+aAhz3fzo/SH0TbxqmCS8t78rVe+AWWKz3uAwcU/OpLFxum94l2uO7GAD4!wUZ3P1HNo7Lcl9pAct/9l9UGKg+RvLHsr/J1Jl4B9mkjz6gsRH2nZCxH/IxAKbbYp/d3fM0= 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: 3381 Xref: csiph.com comp.lang.c:112213 Tim Rentsch writes: > Gareth Owen writes: > >> Tim Rentsch writes: >> > Thank you for the glowing description. If you don't mind a > further question, I'm curious to know what you don't agree > with and why. Not to debate or argue about it, just to > satisfy my curiosity. Please feel free to send that by > email if that makes things easier. I will briefly, because I think we're really subjective territory, and I'm not sure how well I can explain myself, or even if it'll be very elucidating if I do: > "Count one for each buffer position that matches the > argument character." > > That English description is (IMO, of course) more directly > expressed by 'k += b[i]==c' (or something similar) than by a > conditional assignment Really, this is the bit that I don't agree with - and I think its how our minds have respectively come to read code, that I can't read that line of code in your sense without it feeling unnatural to me. Don't really understand why. I think possibly part of it is that something in my mind is seeing the right-hand-side as "true" rather than 1 - and as soon as I think "Boolean" I'm right into thinking about predicates and conditionals. When you read some prose, say, that you consider well written, your mind parses the meaning and the poetry out without you ever consciously thinking about the words. But if an author uses a clunky conjunction, or just an idiom with which you're insufficiently familiar -- clearly the best analogy here -- (or just outright writes a few sentences in Spanish, thank you, Cormac McCarthy) you're jerked right back into the text to try and figure out what was intended. There's something about the implicit conversion from "true" to "1" that requires a tiny extra element of conscious thought that prevents smooth comprehension. Does that make even the slightest bit of sense? (Told you it'd be unhelpful.)