🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #589

Re: Taming The Switch-Statement

#589
From: Waldek Hebisch
Date: Tue, 20 Oct 2026 01:03
64 lines
3957 bytes
bart <bc@freeuk.com> wrote:
> 
> OK. But they HAD to create C? There were quite a few languages in the 
> early 70s too: like Pascal, Fortran, PL/I, Coral-66, plus of course BCPL 
> and B. So why a new one?

You ignore fact that Ritche wanted reasonably fast code from
very simple compiler.  Around 1970 that meant in particular
pointer arithmetic.  Also, address operator allowed simple
interfacing between pointer-oriented code and use of variables.
It is hard to imagine getting similar effect with different
semantics.  IIUC C was not the only language going in this
direction, but mainstream languages were different.

Concerning specific languages, there was FORTRAN 66, it had 'do'
loop as only structured control structure, there rest of control
was via gotos.  And the only data structure were array.  Without
extentions FORTRAN 66 was unsuitable for system work, and arguably
for non-numeric work even early C was nicer than FORTRAN 66.
For reasonable speed FORTRAN 66 needed an optimizer which led
to compiler too big to run on a small machine.

PL/I had most needed features.  But PL/I was a big language,
to run on small machine they would have to take tiny subset
and then add extentions.  Basicaly they would end up with a
language which is very far from PL/I.

Similarly, BCPL was too complicated, B and C were simplifications
and adaptations small machine.

I think that Pascal was too late: nominally it was created earlier
but I think that it was available to Bell Labs only after they
did initial work leading to C.  And Pascal shared problem of
speed on small machines.  Note that later UCSD Pascal which
run on micros compiled to interpreted bytecode, which significantly
reduced performance.

> FORTRAN syntax looked nothing like C! Unless you mean the general 
> pattern of 'INTEGER A, B' which was shared by half of all languages.

I think more pattern of

INTEGER A(20), B

which has similar structure to C variable declarations.  Of course,
FORTRAN had no pointers (and structures or unions), so Ritche had
to invent syntax for them.

IMO C suffers because typedef was added late in the game and
function prototypes are much later.  Prototypes need types and
to get it one needs "hole" in variable declaration.  Where the
hole should be is specified by the C syntax, but placement of
hole is probably least clear aspect of declarations.

IMO C declaration syntax was a mistake, but as real life shows
it was not a fatal mistake, people can adapt.  Note that in
eighties C position among system languages was not as strong as
it is now.  In particular there were quite decent Modula 2
compilers and ony many machines Pascal was competitive too.
But there were no mass migration from C to other languages.
In fact C was gaining use and other languages lost their position.

-- 
                              Waldek Hebisch
Technical Details
Message-ID: <11b6ekh$d2qm$1@paganini.bofh.team>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
References: <119qf6l$2rmg3$1@dont-email.me> <11avmfb$55rt$1@dont-email.me> <11b0cvs$skc$1@reader2.panix.com> <11b0mfv$j5ll$1@dont-email.me> <11b3r71$6me$1@reader2.panix.com> <11b500f$216c4$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!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: antispam@fricas.org (Waldek Hebisch)
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Tue, 20 Oct 2026 01:03:15 -0000 (UTC)
Organization: bofh.team Usenet service
Message-ID: <11b6ekh$d2qm$1@paganini.bofh.team>
References: <119qf6l$2rmg3$1@dont-email.me> <11avmfb$55rt$1@dont-email.me> <11b0cvs$skc$1@reader2.panix.com> <11b0mfv$j5ll$1@dont-email.me> <11b3r71$6me$1@reader2.panix.com> <11b500f$216c4$1@dont-email.me>
Injection-Date: Tue, 20 Oct 2026 01:03:15 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="428886"; mail-complaints-to="usenet@bofh.team"; posting-host="d028f9ad2fa2c51f22dbfed0d81d7daf"; posting-account="69e66f1681224ab92235b464ce7a90b6"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
X-Postfilter: Postfilter-NG 2026.10.2