Article View: comp.lang.c
Article #2255Re: Iterators over slices and views and ranges analogs in C
From: Kaz Kylheku
Date: Sat, 05 Dec 2026 18:01
Date: Sat, 05 Dec 2026 18:01
39 lines
3396 bytes
3396 bytes
On 2026-12-05, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote: > On 2026-12-05 16:43, David Brown wrote: >> On 05/12/2026 15:36, Janis Papanagnou wrote: >>> On 2026-12-04 15:38, David Brown wrote: >>>> On 04/12/2026 14:58, Janis Papanagnou wrote: >>>>> >>>>> Grafting features to a language that wasn't designed to support >>>>> those regularly often lead to clumsy, ugly, inconsistent designs. >>>>> So while it's not surprising, but it also won't change what "C" >>>>> actually is (and what's discussed here, the C-language). >>>> >>>> I don't think _Generics are clumsy, ugly or inconsistent - they are >>>> actually quite clear and simple. But they do get bulky if you want >>>> to support more than one parameter. > > Well, if it's considered (for any underlying thought) good to use > macros with C-generics then I think something got wrong. Generic selection operates on the type of an expression as something unknown. One situation in which that occurs is metaprogramming, which is only done with macros or code generation in C. The other situation is when we have a typedef that can be defined in multiple ways (e.g. for portability). Generic selection could be used outside of a macro to select a variant of code based on which way something is typedefed. That's going to be a minority usage, I suspect. The backstory behind _Generic is that first C99 introduce type-generic math in a <tgmath.h> header. This mechanism required unspecified compiler magic. Finally C11 defined _Generic, which allowed tgmath to be expressed in code. So that can be seen as the motivation for it. -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca
Technical Details
Message-ID:
<20261205094941.763@kylheku.com>Path:
mbox-mo1.pugleaf.net!news-lon.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> <11ett3b$1a41p$1@dont-email.me> <11euadh$1gp4t$1@dont-email.me> <11euckd$1ht9i$1@raubtier-asyl.eternal-september.org> <11eugtg$erg$4@dont-email.me> <11euj8b$1lhf1$1@dont-email.me> <11f17h5$2dad1$1@dont-email.me> <11f1beh$2vtg1$1@dont-email.me> <11f1ggn$2dad1$2@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.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: Kaz Kylheku <046-301-5902@kylheku.com> Newsgroups: comp.lang.c Subject: Re: Iterators over slices and views and ranges analogs in C Date: Sat, 5 Dec 2026 18:01:17 -0000 (UTC) Organization: A noiseless patient Spider Lines: 39 Message-ID: <20261205094941.763@kylheku.com> References: <-kGdnSzB4bWEM4z2nZ2dnZfqn_WdnZ2d@giganews.com> <11esd12$mfam$1@raubtier-asyl.eternal-september.org> <11et39b$rj55$1@news.xmission.com> <11ett3b$1a41p$1@dont-email.me> <11euadh$1gp4t$1@dont-email.me> <11euckd$1ht9i$1@raubtier-asyl.eternal-september.org> <11eugtg$erg$4@dont-email.me> <11euj8b$1lhf1$1@dont-email.me> <11f17h5$2dad1$1@dont-email.me> <11f1beh$2vtg1$1@dont-email.me> <11f1ggn$2dad1$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 05 Dec 2026 18:01:18 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3294171"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+xwp3rzT8DACcNvtYNzVEXJLxfko7DqQ="; posting-host="1ff8110bc583ea261ab992f3669e9a03" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:3Oq/KVWg8VmI2LnySJkXhTOKcY4= sha256:J1+J+bJlagCsK7InLLmdUlB17rx6RV9L1iymMAR6Df8= sha1:idxT/nrUPdHG3sboXeeZLFY0GHY= sha256:GAmqSmtS9ow9APLR5G+oPpndlVJzGUZqoAWpzMkpO+0=