Article View: comp.lang.c
Article #107Re: Taming The Switch-Statement
From: Kenny McCormack
Date: Sat, 10 Oct 2026 13:14
Date: Sat, 10 Oct 2026 13:14
30 lines
2463 bytes
2463 bytes
In article <11ac783$1bkuo$1@kst.eternal-september.org>, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: ... >The ANSI C Rationale says "No serious consideration was given to >making the switch more structured, as in Pascal, out of fear of >invalidating working code". > >I suppose some version of C could have defined a new switch-like >statement without the fallthrough behavior. I can see some small >advantages in doing so, but the existing switch with fallthrough >would have to be kept in the language -- and such a new switch-like >statement would have added no real expressive power. We'd now have >a mix of code using the old and new constructs, pressure to convert >existing working code, and probably errors introduced by converting >code incorrectly. You are probably right that C itself will never have such a construct added (*). But the point is that there are many C-derived languages - languages that use C's basic syntax (especially, using curly braces). C++/C#/Swift - probably others. These languages are free to have (and probably do) have better switch/case/whatever-you-want-to-call-it constructs. (*) Although I certainly think it would benefit from doing so. -- To be evangelical is to spend every waking moment hovering around two emotional states: fear and rage. Evangelicals are seriously the angriest and most vicious bunch of self-pitying, constantly-moaning whinybutts I've ever encountered.
Technical Details
Message-ID:
<11addmq$3k6om$1@news.xmission.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.nrbbs.org!csiph.com!xmission!nnrp.xmission!.POSTED.shell.xmission.com!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>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.nrbbs.org!csiph.com!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail From: gazelle@shell.xmission.com (Kenny McCormack) Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Sat, 10 Oct 2026 13:14:02 -0000 (UTC) Organization: The official candy of the new Millennium Message-ID: <11addmq$3k6om$1@news.xmission.com> 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> Injection-Date: Sat, 10 Oct 2026 13:14:02 -0000 (UTC) Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4"; logging-data="3808022"; mail-complaints-to="abuse@xmission.com" X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: gazelle@shell.xmission.com (Kenny McCormack)