Article View: comp.lang.c
Article #160Re: Taming The Switch-Statement
From: Johann 'Myrkraverk' Oskarsson
Date: Sun, 11 Oct 2026 01:09
Date: Sun, 11 Oct 2026 01:09
51 lines
4101 bytes
4101 bytes
On 10/11/2026 6:58 AM, Lawrence D’Oliveiro wrote: > 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/> I don't see this as a problem with C. This can happen in any program- ming language, and code with nested control structures. And if I recall correctly, you can't use /break/ with a label inside a switch in Java -- please correct me if I'm wrong, I'm feeling lazy to check it out right now -- which results in similar shenanigans and po- tentially even more convoluted control structures. So, Lawrence, please enlighten us about how you concoct convoluted con- trol structures in Python, because that's what you live for. Best wishes, and happy convolution inside control structures in C! -- Johann | email: invalid -> com | http://www.myrkraverk.com/blog/ I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:; Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social
Technical Details
Message-ID:
<FlByS.11178$mPXe.3035@fx06.ams4>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx06.ams4.POSTED!not-for-mailReferences:
<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> <11aefu7$254m6$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!peer02.iad!feed-me.highwinds-media.com!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx06.ams4.POSTED!not-for-mail MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Taming The Switch-Statement Newsgroups: comp.lang.c 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> <11aefu7$254m6$1@dont-email.me> Content-Language: en-US From: Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> Organization: Watcom Pro Ltd. In-Reply-To: <11aefu7$254m6$1@dont-email.me> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Lines: 51 Message-ID: <FlByS.11178$mPXe.3035@fx06.ams4> X-Complaints-To: abuse@easynews.com X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly. Date: Sun, 11 Oct 2026 09:09:55 +0800 X-Received-Bytes: 3916