🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #478

Re: Taming The Switch-Statement

#478
From: Dan Cross
Date: Sat, 17 Oct 2026 17:58
151 lines
7056 bytes
In article <11avmfb$55rt$1@dont-email.me>, bart  <bc@freeuk.com> wrote:
>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.

Riiiight.  C++ is widely considered "more productive" than C,
and yet shares most of the syntactic warts you complain about so
readily.

>> 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!)

Yes.  C's declaration syntax is famously abstruse; film at 11.

>> 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.

Ok.

>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.

Ok.

>>> 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.

There does not appear to be one.

>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.

Unknowable.

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

Irrelevant.

>>> 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.

Then your point is minor at best.  Here's a thought experiment:
suppose I suddenly came to my senses and agreed with everything
you say: I'm willing to totally toss out C and adopt Bart's
language yesterday.  Where do I get a compiler?  What learning
resources exist?  Oh, and I need it to generate code for an
ARM Cortex-M0 part; does it do that?  I also need RV64GC and
x86_64 and probably aarch64, too.  Might want to throw in
Xtensa while we're at it: does your compiler do all of that?
What if I need a debugger?  Oh, and I need to use crypto
libraries that are supplied from a vendor; they use the C ABI.
What's the inter-op story like?

>> 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.

Really, the entire thread could be summed up in that one word,
and it would save everyone a lot of time.

>> 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).

No.  That was B; the PDP-7 was an 18-bit word-oriented machine,
and was archaic even in 1968 when they started using it.  C was
done on the PDP-11.  An early cross-compilation environment on a
GE-635 computer also existed, but the primary work on the
language was on the 11/20 running Unix.

You know, all of this is in Dennis Ritchie's C history paper,
presented at SIGPLAN's HOPL-II, which is online.  If you could
get over yourself for like 20 minutes you could read it, and
then not talk out your ass about history.
https://www.nokia.com/bell-labs/about/dennis-m-ritchie/chist.html

I suspect your general factual resistance is one of the several
reasons so few people around here take you or your language
seriously.

>[snip]
>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.

(A very different machine from an 11/20.)

>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.

Good for you.  Totally irrelevant to the history of C.

Let me forestall the inevitable: you are going to reply and just
repeat the same things over again.  I don't care.  None of this
is an objective discussion of C; and it really comes across as
you just seeking affirmation, which is genuinely sad.

	- Dan C.
Technical Details
Message-ID: <11b0cvs$skc$1@reader2.panix.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
References: <119qf6l$2rmg3$1@dont-email.me> <11auad0$3no1k$1@dont-email.me> <11aupfl$3ul$1@reader2.panix.com> <11avmfb$55rt$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Sat, 17 Oct 2026 17:58:20 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <11b0cvs$skc$1@reader2.panix.com>
References: <119qf6l$2rmg3$1@dont-email.me> <11auad0$3no1k$1@dont-email.me> <11aupfl$3ul$1@reader2.panix.com> <11avmfb$55rt$1@dont-email.me>
Injection-Date: Sat, 17 Oct 2026 17:58:20 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
	logging-data="29324"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)