Article View: comp.lang.c
Article #468Re: Taming The Switch-Statement
From: bart
Date: Sat, 17 Oct 2026 12:11
Date: Sat, 17 Oct 2026 12:11
55 lines
3247 bytes
3247 bytes
On 17/10/2026 12:09, Kenny McCormack wrote:
> In article <11audde$3oci5$1@kst.eternal-september.org>,
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> bart <bc@freeuk.com> writes:
>> [...]
>>> What's often stated also is how successful C has been, but that
>>> doesn't magically make the syntax wonderful.
>>
>> NOBODY THINKS C'S SYNTAX IS WONDERFUL.
>
> The funny thing is: I actually do.
>
> I may be the only person here who actually thinks the syntax of C's
> "switch" statement is just fine. Once you realize that it *is* more of a
> computed goto
Then maybe the syntax for it should have been:
goto (x) {}
instead of:
switch (x) {}
That would not clash with 'goto label', nor the 'goto *(x)' of gnu C.
It would make it clearer that this is a cruder construct than 'switch'
pretends to be, AND it saves a keyword!
That saving could have gone towards giving switch-break its own keyword
instead of having to share 'break' with loops (because there was
apparently a shortage of keywords in 1972).
That was always going to clash at some point, and it does.
> sense (to me, anyway). I have no problem with a declaration like:
>
> int i,j,*ip,arr[10],foo(int bar);
>
> Some would say that declares lots of different types of objects, but I
> think of them all as ints (which is what the declaration is telling us).
It's taking a bunch of unrelated types of arbitrary complexity, but
because they all end with a type T when expressed in LTR form, they all
belong together?
That doesn't work: i, ip, arr, foo all have different types.
They only have the same types when fully dereferenced, indexed or
called, when written as i, *ip, arr[i], foo(i). This is NOT when happens
within the declaration, and it might not happen when they appear in
expressions either.
It's just confusing.
Technical Details
Message-ID:
<11avolp$61gp$1@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> <11at5vi$5vu$1@reader2.panix.com> <11auad0$3no1k$1@dont-email.me> <11audde$3oci5$1@kst.eternal-september.org> <11avl11$poq2$1@news.xmission.com>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: bart <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Sat, 17 Oct 2026 13:11:37 +0100 Organization: A noiseless patient Spider Lines: 55 Message-ID: <11avolp$61gp$1@dont-email.me> References: <119qf6l$2rmg3$1@dont-email.me> <11at5vi$5vu$1@reader2.panix.com> <11auad0$3no1k$1@dont-email.me> <11audde$3oci5$1@kst.eternal-september.org> <11avl11$poq2$1@news.xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 17 Oct 2026 12:11:37 +0000 (UTC) Injection-Info: dont-email.me; logging-data="198169"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+gVv+P02yn2gNjX3U/BVOQ"; posting-host="f42af6156aabd93e2f9ced57c648ec1a" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:7fKc3MRPZ2HkhktA4Sx0RM79SeY= sha256:AfJ+3wmMPqAcZzOe+Tgd28WSfchMKfTSY21bBCXMN1M= sha1:2NxkiHfhd4jR1T7bkX6pFF/uevE= sha256:msu88Jrj5Rd4yXAK0GZjHEMtn4Cgk9tznvfHLz8aFkc= Content-Language: en-GB In-Reply-To: <11avl11$poq2$1@news.xmission.com>