🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #467

Re: Taming The Switch-Statement

#467
From: bart
Date: Sat, 17 Oct 2026 11:34
105 lines
5766 bytes
On 17/10/2026 04:19, Dan Cross wrote:
> In article <11auad0$3no1k$1@dont-email.me>, bart  <bc@freeuk.com> wrote:

>> Those are considered more productive.
> 
> ...and you think that's because of the syntax, and not the high
> level nature of those languages?

It's a combination.

> Yes, the syntax is pretty gnarly; Dennis Ritchie even said as
> much.  Fixed in Go and Rust, but also, I doubt you've ever in
> your life had a variable of type array of array of length 8 of
> a pointer to a pointer to a function returning an array of
> pointers to char.  Finding the most ridiculous example you can
> is not really evidence of anything besides your weird obsession

That was the first one I saw online next to a quote from K&R and I 
assumed it was from the book. In fact the example from the book is this:

   char (*(*x())[])()

I've no idea what the means either. The point is not that the examples 
are ridiculous, but that they are hard to convert to and from LTR form 
which is how we think. With LTR syntax it becomes utterly trivial to 
read or write them, no matter how complex.

(There's a tool called CDECL that translates types from C syntax to LTR 
English or vice versa. It calls the C versions 'gibberish'. This is a 
real thing!)


> with finding abstruse corner cases and holding them up as
> reasons to dislike C.

The first example I gave was the simplest form of function pointer, 
where the syntax is 'void(*)(void)'. Hardly a corner case, and it 
rapidly goes downhill.

If meeting C for the first time, that does not bode well. If the 
designers did not care about this, that does not inspire confidence in 
the rest of the language.

>> If DMR had instead produced a language that looked like mine (say like
>> one of the Algols), and I came along in 2026 and proposed a syntax that
>> looked like the above, what do you think the response would be?
> 
> But he didn't, and you didn't, so this is a meaningless
> historical, "what if?"

You don't get the point. If C had used LTR type syntax and somebody 
proposed using inside-out back-and-forth syntax like 'void(*)(void)', 
they'd think they were having a laugh, as it would be ridiculous.

But this is exactly what I think about it anyway, no matter that 100 
million programs have battled with it for 50 years.

> 
>> So being 'objective' means disregarding history and widespread adoption.
> 
> Well, no...both of those are factors in choosing a language or
> not.  We can discuss the semantics of the language, it's syntax,
> etc; but we can also discuss tooling, engineering resources
> availability (can you find programmers who know C?  More like,
> can you find programmers who _don't_ know C, amirite?), library
> and platform support, and so on.

Yes, this is my point; it is tolerated, and people learn to work with 
it. But how much extra effort has been expended, compared if they'd 
tried a bit harder to get a better language at the start? Or even during 
its first decade.

> Is C a good language?  Meh, it's not the worst, but far from the
> best I've seen.  Was it a bad language in 1972, when it was
> targeting a PDP-11/20?  No, it was pretty decent for that era.

Disagree.

> Did it do all the stuff that fancy languages with advanced
> compilers that ran on big machines could do?  No.  Did it need
> to?  Also no.

I think C was first created for PDP7 with 4K words, then moved to PDP11 
(don't know the spec).

My first language was created nearly a decade later on a /homemade/ 
microprocessor system with 32KB, but no viable storage. So compiler 
binary and data, editor, program source code, binary and data all had to 
reside in memory at the same time.

That crude language had 'print x' and loops that looked like 'for i:=a 
to b do'. It also had a 'byte' type (ie. u8).

A year or two later, with 64KB and storage, it was more full-featured. 
It was a viable and practical alternative to C which I had looked at, 
and dismissed.

Fun fact: my copy of K&R1 cost me £12. My first Z80 processor cost £10.

My point is you can't excuse C being what it is due to hardware limitations.

I used PDP11 quite a bit (/34) and that had a decent Fortran implementation.

My own stuff was done in my spare time for no extra pay, on 8-bit 
machines I helped develop for my company, without the backing of Bell Labs.
Technical Details
Message-ID: <11avmfb$55rt$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-mail
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>

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 12:34:02 +0100
Organization: A noiseless patient Spider
Lines: 105
Message-ID: <11avmfb$55rt$1@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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 17 Oct 2026 11:34:04 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="169853"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/UXpZHMUVFCZgFNqBQbmri"; posting-host="f42af6156aabd93e2f9ced57c648ec1a"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:QblxDGctpDbmzplwU/4bOaVmzfs= sha256:GDn/bGBPSlzb4ofDSluSLQ6IMOJAAjBO3Flxs6awcr0=
	sha1:p2Fh9BDdKH66MC20iwEN5I8jeb8= sha256:vtZ0B1PFDNlOTTltYevmESi0zrMfsFlzHY4HYtAWG8s=
In-Reply-To: <11aupfl$3ul$1@reader2.panix.com>
Content-Language: en-GB