Article View: comp.lang.c
Article #578Re: Taming The Switch-Statement
From: Janis Papanagnou
Date: Mon, 19 Oct 2026 23:18
Date: Mon, 19 Oct 2026 23:18
72 lines
4736 bytes
4736 bytes
On 2026-10-20 00:48, Keith Thompson wrote: > Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes: >> On 2026-10-18 21:09, David Brown wrote: >>> On 18/10/2026 18:09, bart wrote: >>>> [...] >> [ declaration syntax ] >> >> (I just want to comment on a [not unimportant] detail...) >> >>> You need to give things in the right order, or use parentheses, to >>> get the right "type expression". It's just like any other kind of >>> expression. >>> The intention of the declaration syntax in C is that the declaration >>> order follows usage. [...] >> >> I think the first part is downplaying that languages typically indeed >> make a distinction between parenthesized expressions and declarations. >> Quite some other languages [not from the C-heritage] that I used all >> did not need to introduce "expression"-grouping for _declarations_ in >> the first place given their more consistent ways to declare entities. > > Just one quibble. C's declaration syntax *is* consistent. Its > rules are rigorously specified by the standard, particularly by > the grammar. Yes, sure. It's well defined and all that. - What I tried to express by that is that the building rules are not... - coherent, consistent? Well, I think on that level speaking about "inconsistency" is fine. But okay. I think we all know what we have with C's declaration syntax. (And we all, but maybe one, can live with it.) > > Many of us (myself included) don't particularly like it, but that > doesn't mean it's inconsistent. > > My own take on all this is that having declaration syntax follow usage > was a very clever idea, where "clever" is not necessarily a compliment. Well, to return the quibble, clever is a compliment (while "clever" in quotes is obviously not). :-) I don't consider it to have been a clever idea. (No quotes.) But I had mentioned that elsethread already before, and it's IMO not worth a dispute. > It was IMHO unsuccessful in the sense that it can lead to confusing > and overly complicated declarations. And that's the essence of the criticism, I think. > (Other languages don't have tools > corresponding to cdecl for much the same reason that Spanish-speaking > countries don't have spelling bees.) But it was extraordinarily > successful in the sense that, even if you think it was a bad idea, > it wasn't bad enough to keep C from becoming one of the most popular > programming languages. Undoubtedly. (It wasn't bad enough.) - Now imagine if it were better! Would have all folks using - what-do-I-know, say, Java - then have settled with "C"? - I'm just kidding. > > (I wonder if keeping the declaration-follows-use principle while > making "*" a postfix operator might have improved things.) I'm confused about the recent emphasis of such a change; it very much sounds to me like: "we have a problem lets try fixing it by changing something else [instead of addressing the problem]"; both are useless thoughts. (Yes, I understand that you think about it academically.) Janis
Technical Details
Message-ID:
<11b68gm$1kr9u$9@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<119qf6l$2rmg3$1@dont-email.me> <11arjmc$2qid7$1@dont-email.me> <11at5vi$5vu$1@reader2.panix.com> <11auad0$3no1k$1@dont-email.me> <11aupfl$3ul$1@reader2.panix.com> <11avmfb$55rt$1@dont-email.me> <11b2a6d$131h6$1@dont-email.me> <11b2hr6$15thq$1@dont-email.me> <11b2l06$16mof$1@dont-email.me> <11b2qv0$19h68$1@dont-email.me> <11b35gt$1cn63$2@dont-email.me> <11b557o$1kr9u$1@dont-email.me> <11b66ng$2fcat$2@kst.eternal-september.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!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: Taming The Switch-Statement Date: Tue, 20 Oct 2026 01:18:46 +0200 Organization: A noiseless patient Spider Lines: 72 Message-ID: <11b68gm$1kr9u$9@dont-email.me> References: <119qf6l$2rmg3$1@dont-email.me> <11arjmc$2qid7$1@dont-email.me> <11at5vi$5vu$1@reader2.panix.com> <11auad0$3no1k$1@dont-email.me> <11aupfl$3ul$1@reader2.panix.com> <11avmfb$55rt$1@dont-email.me> <11b2a6d$131h6$1@dont-email.me> <11b2hr6$15thq$1@dont-email.me> <11b2l06$16mof$1@dont-email.me> <11b2qv0$19h68$1@dont-email.me> <11b35gt$1cn63$2@dont-email.me> <11b557o$1kr9u$1@dont-email.me> <11b66ng$2fcat$2@kst.eternal-september.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 19 Oct 2026 23:18:47 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1731902"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/iu7wvZJPmqaXsCY0zesym"; posting-host="9a1787de1638a6d9f83c958712c1b12a" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:haoJCmh9JQBhmGqdpejNe6bb7eA= sha256:mxBxqmeHALi87T2bcytBVMymPUmXzYxH9hQ8Vs0nVpk= sha1:B9IlzbdllfP7WIhQcPGs5HQ0daY= sha256:7769qUmTZzi6u7bNLMIPhsOTPmwqds736kCn2ws7eYg= Content-Language: en-US In-Reply-To: <11b66ng$2fcat$2@kst.eternal-september.org>