Article View: comp.lang.c
Article #2213Re: Iterators over slices and views and ranges analogs in C
From: Thiago Adams
Date: Fri, 04 Dec 2026 19:32
Date: Fri, 04 Dec 2026 19:32
38 lines
2845 bytes
2845 bytes
Em 04/12/2026 12:03, Ross Finlayson escreveu: > On 12/04/2026 05:03 AM, bartc wrote: >> On 04/12/2026 12: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 ! >>> >> >> How would you do typename(x) in C++ then? >> >> That is, return the type of expression 'x' as a string (in some >> canonical form). >> >> This is not really generics, but reflection. >> >> In my language it would be: >> >> 'x.typestr' >> >> (With 'x.type' returning a unique ordinal for the type, which can be >> used for comparisons etc.) >> >> > > Methinks the standard says that according to _Generic construct that > cv-qualified types are distinct types with regards generic (_Generic, > the "generic" construct in C. > To separate const from non const in _Generic use _Generic(typeof(expr), ...) It is for C2Y but it is already implemented in clang. Thiago
Technical Details
Message-ID:
<11ev4gu$1uaih$1@dont-email.me>Path:
mbox-mo1.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> <11eudm8$1igc3$1@dont-email.me> <a8adndvZlvSgS4_2nZ2dnZfqn_WdnZ2d@giganews.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.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: Thiago Adams <thiago.adams@gmail.com> Newsgroups: comp.lang.c Subject: Re: Iterators over slices and views and ranges analogs in C Date: Fri, 4 Dec 2026 16:32:45 -0300 Organization: A noiseless patient Spider Lines: 38 Message-ID: <11ev4gu$1uaih$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> <11eudm8$1igc3$1@dont-email.me> <a8adndvZlvSgS4_2nZ2dnZfqn_WdnZ2d@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 19:32:46 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2042449"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Y4zA2BUEy78fETDee8Q4MsjzGLgjv8J0="; posting-host="2b5299ee84adcd4a60e07c958d1482b6" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:x8zneUVk1l6wlp8/zATVOGL5Wmo= sha256:2LGZLYAiSwVtmYMSnqxbd2McOa2tgghqTOFqVLuxs38= sha1:LheGLZSCaQ3JeQUQWIipk8aOdLg= sha256:WV0z3ni67vjJTuSmybjLtQh/RxhKb224RA2S65cMdkQ= In-Reply-To: <a8adndvZlvSgS4_2nZ2dnZfqn_WdnZ2d@giganews.com> Content-Language: en-GB