🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #2176

Re: Iterators over slices and views and ranges analogs in C

#2176
From: Janis Papanagnou
Date: Fri, 04 Dec 2026 13:58
37 lines
3249 bytes
On 2026-12-04 13:45, Bonita Montero wrote:
> Am 04.12.2026 um 13:07 schrieb bartc:
> 
>>   #define typename(x) (_Generic((x),\
>>       int:                   "int",\
>>       unsigned int:          "unsigned int",\
>>       const int:             "const int",\
>>       default:               "other"))

> Compared to C++ generics this really, really sucks !

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).

What I'm wondering about, though, is what the actual "customers"
for such features in "C" are, and what the "vendors" (compiler
writers and standards people) think when introducing such things.
Upthread it had been speculated (by David) that this feature is
probably "underused", and another comment (from Bart) hinted on
a non-obvious restriction (in implementations or the standard).
Folks who want something better designed, more consistent, with
cleaner syntax, and with less restrictions and arguable choices,
might choose to use C++ (or something else).

So, who are the "C" clients for whom this feature is important?

N.B.: I've been heavily using C++ polymorphism in sophisticated
designs but never(?) needed RTTI. (Clean OO-programming made it
unnecessary to switch on types.) I used generic data structures
a lot in C++, though, and their advantages (compared to "C")
are obvious. I also never needed introspection. - I guess it's
depending on the programming paradigms one chooses.

Janis
Technical Details
Message-ID: <11eugtg$erg$4@dont-email.me>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
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>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: Iterators over slices and views and ranges analogs in C
Date: Fri, 4 Dec 2026 14:58:08 +0100
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <11eugtg$erg$4@dont-email.me>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 04 Dec 2026 13:58:09 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="15216"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18z6rwCO0SZic77j+A69gvm"; posting-host="0caabeed4f2975d91b78c76dfe5b0004"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:OCXsNQhgFSQ8e7M+YjKx+CUbt7M= sha256:qQTxds9vUl+6QROxIWS5FxiztAXVbUNHoLi0tCLHxvI=
	sha1:IDMEq7w/7cb4FiZdtD8if1pZ5e4= sha256:bGnBjlNzqbHzrjckxg1nu9c0ZSebe9qFembWlm12yEM=
In-Reply-To: <11euckd$1ht9i$1@raubtier-asyl.eternal-september.org>
Content-Language: en-US