🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #153

Re: Taming The Switch-Statement

#153
From: Lawrence D’Oliveiro
Date: Sat, 10 Oct 2026 22:58
30 lines
3235 bytes
On Sat, 10 Oct 2026 15:30:54 -0700, Andrey Tarasevich wrote:

> But `break` and `continue` behave differently inside `switch` in C:
> the former can "see" the enveloping `switch` statements, while for
> the latter all enveloping `switch` statements are completely
> transparent. So, in order to refer to the same cycle one'd have to
> use different nesting numbers in `break` and `continue` when used
> inside `switch`(-es) in C. That would look quite confusing.

It also led to a major real-world calamity: the Great AT&T Telephone
Crash of 15th January 1990. To quote from Bruce Sterling’s “The Hacker
Crackdown”:

    As it happened, the problem itself -- the problem per se -- took
    this form. A piece of telco software had been written in C
    language, a standard language of the telco field. Within the C
    software was a long "do... while" construct. The "do... while"
    construct contained a "switch" statement. The "switch" statement
    contained an "if" clause. The "if" clause contained a "break." The
    "break" was *supposed* to "break" the "if clause." Instead, the
    "break" broke the "switch" statement.

Back at the time, law enforcement was just cottoning on to the idea
that evil people could use their technical skills with computers to
wreak havoc with all kinds of crucial infrastructure. AT&T figured
out, within nine hours, that the problem here was purely a mistake in
their software, but it took somewhat longer for some authorities to be
disabused of the notion that this was intentional sabotage.

<http://web.archive.org/web/20031204221934/www.chriswaltrip.com/sterling/>
Technical Details
Message-ID: <11aefu7$254m6$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> <11ac0mi$19kfd$1@dont-email.me> <11ac2jv$1a84t$1@dont-email.me> <11ac783$1bkuo$1@kst.eternal-september.org> <11ad5eq$1l8hg$1@dont-email.me> <11ad9fg$cjm0$4@dont-email.me> <11addhr$1oakb$1@dont-email.me> <11aduuk$cjlv$1@dont-email.me> <20261010220212.000063fd@yahoo.com> <11ae56o$cjlv$4@dont-email.me> <20261010230355.00005189@yahoo.com> <11ae7eb$cjlv$6@dont-email.me> <11aeeau$24vgh$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!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D’Oliveiro <ldo@nz.invalid>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Sat, 10 Oct 2026 22:58:15 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <11aefu7$254m6$1@dont-email.me>
References: <119qf6l$2rmg3$1@dont-email.me> <11ac0mi$19kfd$1@dont-email.me>
	<11ac2jv$1a84t$1@dont-email.me> <11ac783$1bkuo$1@kst.eternal-september.org>
	<11ad5eq$1l8hg$1@dont-email.me> <11ad9fg$cjm0$4@dont-email.me>
	<11addhr$1oakb$1@dont-email.me> <11aduuk$cjlv$1@dont-email.me>
	<20261010220212.000063fd@yahoo.com> <11ae56o$cjlv$4@dont-email.me>
	<20261010230355.00005189@yahoo.com> <11ae7eb$cjlv$6@dont-email.me>
	<11aeeau$24vgh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 10 Oct 2026 22:58:16 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2265798"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/pqUtHA9z4Fq53qUoGttrf"; posting-host="b79ec01f0c353e9abab4d37c266d4491"
User-Agent: Pan/0.165 (Kostiantynivka)
Cancel-Lock: sha1:3p/dRcIEdh0n4vEqnqyKsBg+qUA= sha256:VbmQbJUB4Cdslau4EkxNdeX56/I2IIvmFtyT1zPdPoA=
	sha1:kORktQxpaQFHZLvH0DbGN5Psw20= sha256:hSgap2iHquVGawR+JgLDJBv1HFLdRMhhQJbV4vdfsi4=