Path: csiph.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Nice way of allocating flexible struct. Date: Thu, 09 Oct 2025 20:59:26 -0700 Organization: None to speak of Lines: 51 Message-ID: <87qzvbh0f5.fsf@example.invalid> References: <20251007233002.852@kylheku.com> <10c59nc$1frvi$1@raubtier-asyl.eternal-september.org> <10c5ah6$1frvi$2@raubtier-asyl.eternal-september.org> <20251008125301.000044e0@yahoo.com> <10c5d7e$1gpce$1@raubtier-asyl.eternal-september.org> <10c5qns$1khq2$1@dont-email.me> <10c674k$1oldp$1@dont-email.me> <10c6cjt$1qlkd$1@dont-email.me> <10c7beu$24vls$2@dont-email.me> <10c9j41$3i5n2$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 10 Oct 2025 03:59:27 +0000 (UTC) Injection-Info: dont-email.me; posting-host="1482983652616b850c5f606e9d41c502"; logging-data="3912681"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MkrID5WB6wkbHaVLjnLAA" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:sbGui+cEMjpbqtFKtXc4n/+Qktg= sha1:AlavCKymvoALehtl2rDCOtuLmJg= Xref: csiph.com comp.lang.c:394524 bart writes: > On 09/10/2025 04:49, BGB wrote: [...] > Nobody cares about C syntax. That is so manifestly untrue that I can't imagine what you actually meant. Many of us, myself included, don't particularly like some aspects of C syntax, but that's not the same as not caring about it. > Learning all its ins and outs seems be a > rite of passage. Perhaps. It's also necessary if you want to work with the language. > The trouble is that C-style is so dominant, few people would know what > a decent syntax looks like. Or, more, likely, they associate a clean, > well-designed syntax with toy or scripting languages, and can't take > it seriously. > > But if it looks as hairy as C++ then it must be the business! C syntax has survived and been propagated to other languages because it's well known, not, I think, because anybody really likes it. [...] >> One merit is if code can be copy-pasted, but if one has to change >> all instances of: >>   char *s0, *s1; >> To: >>   char* s0, s1; >> Well, this is likely to get old, unless it still uses, or allows C >> style declaration syntax in this case. > > That one's been fixed (50 years late): you instead write: > > typeof(char*) s0, s1; > > But you will need an extension if it's not part of C23. Yes, that will work in C23, but it would never occur to me to write that. I'd just write `char *s0, *s1;` or, far more likely, define s0 and s1 on separate lines. Using typeof that way triggers my WTF filter. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */