Article View: comp.lang.c
Article #431Re: Taming The Switch-Statement
From: Michael S
Date: Thu, 15 Oct 2026 20:57
Date: Thu, 15 Oct 2026 20:57
161 lines
7829 bytes
7829 bytes
On Thu, 15 Oct 2026 20:42:53 -0000 (UTC) cross@spitfire.i.gajendra.net (Dan Cross) wrote: > In article <11aqpl3$2gdup$1@dont-email.me>, bart <bc@freeuk.com> > wrote: > >On 15/10/2026 12:45, Dan Cross wrote: > >> In article <11aqbqv$2avn3$1@dont-email.me>, bart <bc@freeuk.com> > >> wrote: > > > >>> Perhaps that reused keyword thing is a bigger deal than you > >>> think. The effect of it is unnecessary obfuscation. > >> > >> This is certainly not evidence of that. This is just your > >> assertion that you took a silly example and apparently (maybe?) > >> improved it, based on some unstated, but apparently subjective, > >> criteria. > > > >I am stating that 'break' used to fix C's poor 'switch' feature > >interferes with 'break' used for loops. > > Sure. > > >It's not even my opinion: it's fact. In your example, about a third > >of 'break' tokens are for taking care of switch. > > Ok. > > >My opinion is that it generates pointless clutter (this it would do > >even if a different keyword was used), and it can get confusing when > >switch and loop are mixed up. > > Ok. > > >I actually took your program and ported it to my syntax, as I was > >curious how it would look. This is the result: > > > >https://github.com/bart-2026/langs/blob/main/lexertest.m > > > >(It's been spaced out more, vertically.) > > > >There were some tricky bits of the C to translate, such as: > > > > break; > > default: > > break; > > } > > default: > > *tp++ = ch; > > break; > > } > > } > > *tp++ = '\0'; > > tt = TkSTRING; > > > >where it seems to break from one switch then sneakily falls through > >into the default clauses of the enclosing one! > > Yup. > > >Well, here are some stats: > > > > C Mine > > > > Size 3374 2997 characters (both with hard > > tabs) Non-blank lines 210 174 Lines > > Those seem like pretty meaningless statistics. I could really > care less about 377 fewer bytes. Naturally, different languages > will express these things differently. > > >I did try and run mine: > > > > c:\mapps>test > > 1234 > > tok: tt = tkident, token = '1234' > > abc > > tok: tt = tkident, token = 'abc' > > > >It shows both of these as an identifier. But yours does the same: > > > > c:\c>a > > 1234 > > tok: tt = 1003, token = '1234' > > abc > > tok: tt = 1003, token = 'abc' > > Yup. It's a poorly written program; I am not surprised there > are bugs. It wasn't meant to be an illustration of exemplary > programming, it was meant to illustrate a use case for a > language construct that addresses a use case you appeared to > want support for, but that are now upset about, because it was > not provided in the way you like. Or something. > > >Whatever '1003' means, it's showing the same. So it will do (I don't > >care if the code is buggy, just whether my version is reasonably > >faithful). > > This is actually a good example of the problem you often run > into in these endless c.l.c threads: You seem to take a thing > that was something that was only meant to show one thing, and > asserting that it represents something other than what it was > meant to show, and no matter how many times it is explained to > you that it is not, in fact, what you seem to think that it is, > you persist in your delusion and think that it proves something. > But it doesn't, since you are starting from a false premise, at > which point you whine that you are picked on, treated poorly, > misunderstood, or generally dismissed, to which you conclude > that this can only be due to a slavish devotion to C as it is, > and a refusal to entertain that the language is not perfect. It > is totally lost on you that people may be objecting to what you > are saying on its own merits, since (ironically) you don't seem > able to admit that your own ideas may have their own > deficiencies. > > This whole discussion could be summarized as: > > Bart: "C sucks because Dennis Ritchie stupidly reused `break` > for both loops and switch. He was a tasteless fool." > All: "You can work around that really easily." > Keith: "C added labeled break and continue...." > Bart: "C sucks. My language is better. Here, I fixed C in 4 > lines of code with my `breakloop`, but it still sucks > because C is hopeless." > Me: "No, the real problem is that there's no structured way > break out of nested contexts; your thing only addresses > one special case, and does not compose, so can't cover > the general case." > Bart: "No, it's the overloading. C is terrible and you're all > just too blind to see it. You are all fools, like > Dennis Ritchie." > Me: "I mean, Keith told you how the language is being changed > to address your problem _and_ the other problems in this > general category." > Bart: "Those other problems don't matter. C will never change. > It will suck forever. I mean, have you ever even seen a > use case for these labeled blocks? I don't like them, > therefore they suck, just like C. They also suck > because they solve a problem I don't care about. I have > been doing this for 45 years." > Me: "Here's a program that illustrates the problem. The code > is shit, but shows how it can be used...." > Bart: "This program sucks! You don't _need_ to do it this > way." > Me: "...I mean, I told you it sucked when I posted it...." > Bart: "...I rewrote it in my language. I saved 377 bytes. See > how much C sucks now? My language is better. > Me: "...." > Bart: "My lexer is 50% faster than your lexer. My production > code is an order of magnitude faster. I am a very smart > boy, and deserve a very special gold star on my report > card." > Me: "...Bruh." > Bart: "Dennis Ritchie was a fool. A fool, I say! Haha! > Ahahaha! Muwhahaha!" > So, you don't like Donald Trump. Most people that read comp.os.vms already knew it. But why do you make bart responsible for that?
Technical Details
Message-ID:
<20261015235752.00002222@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-mailReferences:
<119qf6l$2rmg3$1@dont-email.me> <11aqbqv$2avn3$1@dont-email.me> <11aqect$hpr$1@reader2.panix.com> <11aqpl3$2gdup$1@dont-email.me> <11ardsd$26m$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: Thu, 15 Oct 2026 23:57:52 +0300 Organization: A noiseless patient Spider Lines: 161 Message-ID: <20261015235752.00002222@yahoo.com> References: <119qf6l$2rmg3$1@dont-email.me> <11aqbqv$2avn3$1@dont-email.me> <11aqect$hpr$1@reader2.panix.com> <11aqpl3$2gdup$1@dont-email.me> <11ardsd$26m$1@reader2.panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Thu, 15 Oct 2026 20:57:59 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2267740"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Ezf9f7e8HJxYsYg405YLiOWuvuj+m+NY="; posting-host="3b8f45aa92a35cfe2c12d7defbe387f2" Cancel-Lock: sha1:mgyQm7NvvEd+VuTsre/YtFPy12o= sha256:wN7M+Fh11RfYoCggMM6w8QN6llgxnqlmqlm/Y1VB+3Y= sha1:42shn5yqsIu9mH8SkcBcLSYNZWM= sha256:dra+yvpQ2D3yWt6swg8r4tZI9QT0re0clwh+6QkY1+Y= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)