Article View: comp.lang.c
Article #2168Re: Iterators over slices and views and ranges analogs in C
From: David Brown
Date: Fri, 04 Dec 2026 08:19
Date: Fri, 04 Dec 2026 08:19
33 lines
2899 bytes
2899 bytes
On 04/12/2026 01:59, Kenny McCormack wrote: > In article <11esd12$mfam$1@raubtier-asyl.eternal-september.org>, > Bonita Montero <Bonita.Montero@gmail.com> wrote: >> Better use C++ for what you want to do. > > Or Fortran. > > Or 8086 assembler. > > All better choices. Actually, his best choice would be to write the question in comprehensible English and we could start from there. It looks like he has questions about _Generic, and possibly about the use of array types in the controlling expression. That could easily turn into a thread that is both on-topic and interesting here - _Generic is probably somewhat poorly understood and underused by many C programmers. For the record, the controlling expression in a _Generic selection undergoes lvalue conversion and array to pointer conversion - just like when you pass things to a function. So it cannot distinguish between an "int" and a "const int", or between an array type and a pointer to an element of the array. (It /can/ distinguish between "int" and "long", or "long" and "long long", even if they are the same size - it distinguishes between incompatible types.) The prime motivation for _Generic is to make macros for selecting different functions based on the type of argument "passed" to the macro. It lets you write your own <tgmath.h> macros. So just as pointer and array parameters in a function declaration are identical, so too are they identical in a _Generic selection.
Technical Details
Message-ID:
<11ett3b$1a41p$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<-kGdnSzB4bWEM4z2nZ2dnZfqn_WdnZ2d@giganews.com> <11esd12$mfam$1@raubtier-asyl.eternal-september.org> <11et39b$rj55$1@news.xmission.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: David Brown <david.brown@hesbynett.no> Newsgroups: comp.lang.c Subject: Re: Iterators over slices and views and ranges analogs in C Date: Fri, 4 Dec 2026 09:19:54 +0100 Organization: A noiseless patient Spider Lines: 33 Message-ID: <11ett3b$1a41p$1@dont-email.me> References: <-kGdnSzB4bWEM4z2nZ2dnZfqn_WdnZ2d@giganews.com> <11esd12$mfam$1@raubtier-asyl.eternal-september.org> <11et39b$rj55$1@news.xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 04 Dec 2026 08:19:56 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1380409"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/A6LPZPdOWf0ntpdztE5/cbW04VOuALGU="; posting-host="f8d429fc41b298b14a9203a87d5618c6" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:kcdFKlpO/hOIUoqFz/Xu4dtRZCo= sha256:i10g0mpW65JZJRHA3flVwZJMqvWHBqu5ASPdA+m8gbc= sha1:JSSptWdh3IVxvveTcfDg+3xPZnA= sha256:e21MhzRKRWp+Ff7JQMtDs2bseO6xL0P3rOYXtVTE3nA= In-Reply-To: <11et39b$rj55$1@news.xmission.com> Content-Language: en-GB, nb-NO