🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #351

Re: Taming The Switch-Statement

#351
From: Michael S
Date: Tue, 13 Oct 2026 20:16
57 lines
3755 bytes
On Tue, 13 Oct 2026 10:52:55 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) wrote:

> In article <11ajsfi$28f2$5@kst.eternal-september.org>,
> Keith Thompson  <Keith.S.Thompson+u@gmail.com> wrote:
> >[snip]
> >Yes, we all know that.  BCPL had BREAK and ENDCASE.  B apparently
> >dropped both, and then re-added just BREAK.  C inherited break
> >from B.  I haven't seen anyone say that that wasn't a mistake.
> >We just don't spend decades worrying about it.  
> 
> A minor historical quibble: BCPL, at the time of C's invention,
> did not have `ENDCASE`; that came later. We tend to forget that
> BCPL did not stop evolving after C's invention; in fact, it went
> on as a going concern for quite a few more years.
> 
> From Dennis Ritchie's HOPL paper:
> 
> |Not every difference between the BCPL language documented in
> |Richards's book [Richards 79] and B was deliberate; we started
> |from an earlier version of BCPL [Richards 67]. For example, the
> |`endcase` that escapes from a BCPL `switchon` statement was not
> |present in the language when we learned it in the 1960s, and so
> |the overloading of the `break` keyword to escape from the B and
> |C `switch` statement owes to divergent evolution rather than
> |conscious change.
> (https://www.nokia.com/bell-labs/about/dennis-m-ritchie/chist.html)
> 

Good catch. Thank you.

> Note this is the only place in that paper where Dennis Ritchie
> mentions `break`.  Why was it overloaded for `switch`?  He does
> not say, exactly, but he _does_ alude to space being a
> consideration for B, and some of the resulting syntactic quirks
> then escaping into C:
> 
> |Storage limitations on the B compiler demanded a one-pass
> |technique in which output was generated as soon as possible,
> |and the syntactic redesign that made this possible was carried
> |forward into C.
> 
> This is from a section discussing why C did not implement the,
> `valof`/`resultis` mechanism of BCPL: BCPL parsed the whole
> program into memory and operated on the parsed representation;
> B could not afford that luxury.
> 
> Btw, one hypothesizes that some of the subsequent evolution of
> BCPL came from C influence; BCPL added the PL/1-style
> `/* ... */` comments, and it wouldn't surprise me if `ENDCASE`
> came from C's `break` inside of a `switch`, though I have no
> evidence of that.
> 
> 	- Dan C.
> 

Technical Details
Message-ID: <20261013231606.00003e16@yahoo.com>
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> <11aj73v$c2u$1@reader2.panix.com> <11ajcv8$3u33s$1@dont-email.me> <11ajsfi$28f2$5@kst.eternal-september.org> <11al2i7$gd2$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: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Tue, 13 Oct 2026 23:16:06 +0300
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <20261013231606.00003e16@yahoo.com>
References: <119qf6l$2rmg3$1@dont-email.me>
	<11aj73v$c2u$1@reader2.panix.com>
	<11ajcv8$3u33s$1@dont-email.me>
	<11ajsfi$28f2$5@kst.eternal-september.org>
	<11al2i7$gd2$1@reader2.panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 13 Oct 2026 20:16:09 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="883398"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18AsU95Na+oEgqfMAkHRP1WkrcvzxWunp8="; posting-host="961115672f2b3875de21a3b5d4728503"
Cancel-Lock: sha1:PKuYhCV9ujATQBMuniZaNq3rOlQ= sha256:kiEgneWBmMCSPO4lQh5GsdeQn+s7KD9cX3UzZNATTXA=
	sha1:hu6Uek3iMxye8TNgwZN4/5/yzX8= sha256:VOKWTnL+90fgRZFIoLCibCMdlmVCbD+gtR+y0P6P75U=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)