🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #2205

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

#2205
From: David Brown
Date: Fri, 04 Dec 2026 18:25
72 lines
4696 bytes
On 04/12/2026 19:02, Ross Finlayson wrote:
> On 12/04/2026 09:44 AM, David Brown wrote:
>> On 04/12/2026 17:55, Ross Finlayson wrote:

>>> Then, I went looking for anything else in C that has to do with
>>> type and introducing types or discriminating among types, there's
>>> basically the _Generic construct and __auto_type in C11 + gcc,
>>> where the types are built-ins or fixed-length-arrays or for
>>> struct/union/enum or pointers thereto, with typedef making
>>> aliases not introducing types.
>>>
>>> Then there are expressions _about_ expressions in type,
>>> like sizeof and offsetof if not so much typeof, that I'd
>>> wonder more about typeof, yet I don't gather the use of typeof.
>>>
>>
>> Since you are now talking about C, I am /trying/ to understand what you
>> attempting to say.  It doesn't look like a question, so I can't answer
>> it.  And since I can't figure out what you are trying to say, I can't
>> tell you if it is right or wrong.
>>
>>>
>>>
>>> Perhaps we could talk about typeof, ..., and decltype is
>>> considered _not_ in the language. Here though there
>>> are _Generic and auto, for maintaining type-induction
>>> so type-inference carries.
>>>
>> /Why/ do you write crap like this?  Surely you /know/ that C does not
>> have "decltype" ?  There's no "considered" involved.
>>
>> If you want to talk about "typeof", go ahead.  Ask what you want to know.
>>

> 
> Oh, decltype has snuck its way into compiling C.

No, it has not.

C has "typeof" that is similar to, but noticeably different from, C++'s 
"decltype".    gcc had "typeof" as an extension in C from before C23's 
"typeof" - indeed, from long before C++'s "decltype".

> It's to be avoided, for example with aliasing "gcc"
> to "gcc -std=c11" or "gcc -std=gnu11".

Use gcc to compile C, and there is no "decltype".  Use gcc for C++11 or 
newer C++, and you have standard C++ "decltype".  "decltype" has never 
been part of any C standard, nor any extension in gcc when compiling C.

> 
> I don't need an "always-online oracle", I have one right here.

It's broken.

I try to help people who have C questions, and try to correct people who 
make statements about C that are wrong.  It's always possible that I 
make a mistake myself when doing so - that has happened plenty of times 
over the many years I've been in c.l.c.  (Mostly it has been lack of 
precision, but also I have occasionally been absolutely and clearly 
talking mince.)  Someone else usually corrects me in that case - that's 
how we work together here.

But if you think I am wrong about C, and no one of greater knowledge and 
experience has corrected me - there are plenty of experts around - then 
please provide references and details.  You have not shown a level of 
knowledge warranting being taken on your word.



(snip more drivel.)
Technical Details
Message-ID: <11ev0j0$1skuu$1@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> <11eugtg$erg$4@dont-email.me> <11euj8b$1lhf1$1@dont-email.me> <i5-dnSCmSLz7R4_2nZ2dnZfqnPqdnZ2d@giganews.com> <11eupvu$1p0q1$1@dont-email.me> <0HydndKd_6bFbY_2nZ2dnZfqn_GdnZ2d@giganews.com> <11euu5h$1ra9d$1@dont-email.me> <ZYKdnah1_NuwnY72nZ2dnZfqnPidnZ2d@giganews.com>

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: 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 19:25:35 +0100
Organization: A noiseless patient Spider
Lines: 72
Message-ID: <11ev0j0$1skuu$1@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>
 <11eugtg$erg$4@dont-email.me> <11euj8b$1lhf1$1@dont-email.me>
 <i5-dnSCmSLz7R4_2nZ2dnZfqnPqdnZ2d@giganews.com>
 <11eupvu$1p0q1$1@dont-email.me>
 <0HydndKd_6bFbY_2nZ2dnZfqn_GdnZ2d@giganews.com>
 <11euu5h$1ra9d$1@dont-email.me>
 <ZYKdnah1_NuwnY72nZ2dnZfqnPidnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 04 Dec 2026 18:25:37 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1987550"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/+u6GJQdkwVCIVpo16On+NmraS3VPdj28="; posting-host="f8d429fc41b298b14a9203a87d5618c6"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:juXMc8Rk37fvt5EEXQKu0A8xrZ8= sha256:aJTdCed14u9DmBlt1FDhihh8GcjelojcRAGGTsM+QTU=
	sha1:OAeW/YGSMdZ12NsOiATr5Je5k44= sha256:k4t/4IAHvP2NhQixIP0aYiVjVkRYb6KjujFaHA2cZB0=
Content-Language: en-GB, nb-NO
In-Reply-To: <ZYKdnah1_NuwnY72nZ2dnZfqnPidnZ2d@giganews.com>