Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: memscan() function or equivalent Date: Wed, 07 Jun 2017 16:02:27 -0700 Organization: None to speak of Lines: 45 Message-ID: References: <20170607154705.f161b2807eb2b1a8dc12d389@gmail.com> <12fb0e96-0ac3-442d-8d04-baaef4234a85@googlegroups.com> <20170607164800.a6fba9d07170ec5d056d25a0@gmail.com> <878tl3g5jw.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="014809c4f49cfafbe03afa6d23552d79"; logging-data="30782"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18nWXF1pkAeKV+QyzePnPrw" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:/gDpCaT+LvJcwA6BvOYKda5K3OQ= sha1:yFVc2qHsGyg8nUtvprzGMKyO8P0= Xref: csiph.com comp.lang.c:111766 bartc writes: > On 07/06/2017 17:48, Keith Thompson wrote: >> bartc writes: >> [...] >>> One more thing with the C version: n is size_t so probably unsigned. >> >> "probably"? > > Yes, probably. It was easier to add that word than doing the research > needed to eliminate it. size_t is an unsigned type. > But in C, half of this stuff is defined within the standard headers, > 'conveniently' split up into dozens of separate files (with the language > requiring that there are half a dozen ?time.h or time?.h headers all > redefining the same things). No, the standard defines exactly one header named . No other standard header has the string "time" in its name. (A particular implementation or a separate standard like POSIX might define other headers such as . Some such headers might be intended to be included in user code, others might exist only to implement the standard headers.) size_t is defined in and in several other standard headers that need to refer to it. > Each header can be optionally included, presumably so custom versions > can be used, ones where 'size_t' might be signed. I suppose it would be possible for some implementation-specific header to define "size_t" as a signed type, but it would be stupid (since such a header could not be used along with any of the standard headers that define size_t), and I don't believe any actual implementation would do so. If you're writing a C implementation, or part of one, this is the kind of stuff you really need to know. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"