Article View: comp.lang.c
Article #49Re: Taming The Switch-Statement
From: Chris M. Thomasson
Date: Wed, 07 Oct 2026 21:06
Date: Wed, 07 Oct 2026 21:06
69 lines
4386 bytes
4386 bytes
On 10/7/2026 5:52 AM, bart wrote: > On 07/10/2026 01:42, Kaz Kylheku wrote: >> On 2026-10-05, bart <bc@freeuk.com> wrote: >>> On 05/10/2026 22:48, Kaz Kylheku wrote: >>>> On 2026-10-05, bart <bc@freeuk.com> wrote: >>>>> A lot of what big compilers do is what used to be called 'linting'. >>>> >>>> I don't suspect you can get rid of that in any language. >>>> >>>> The reason is that as experience with the given language grows, it is >>>> found that programmers make certain mistakes, where making formal >>>> syntactic and semantic rules against those mistakes, and sticking >>>> them into the language, would be a poor idea. >>>> >>>> At some point, you are trying to design a pencil that cannot be >>>> used to draw an optical illusion. >>>> >>>>> I don't consider that to be their job, which should be to verify my >>>>> program and turn it into runnable code, and not give opinions. >>>> >>>> That's a waste of potential; why would you refuse a machine that >>>> can apply hundreds of deterministic pattern matching rules against >>>> possible trouble situations in hundreds of thousands of lines of code, >>>> in seconds. >>> >>> I simply don't care about it. I don't have seconds to waste either. >> >> Your implementation of the same thing would take milliseconds, of >> course. > > I wouldn't want it at all. > > But if I had to implement it, I don't know how long it would take. If I > found that it was taking disproportionately long (compared to the main > task of generating a binary), then I would separate it out from the > compiler, as I've suggested. > > For example, if 90% of compile-time was spent on it. > > >>> Here are some common C-compiling scenarios: >>> >>> * You want to build a finished, working, debugged program from source. >>> This does need the compiler spending time double-guessing the >>> author's >>> intentions, and in any case the person building it is not going to >>> mess with the source >>> >>> * You are building a program which is machine-transpiled C code. It >>> should be valid C with no errors. (If there are, that is the >>> responsibility of the transpiler author.) But again you don't care >>> about style, or the fact that there are lots of unused labels for >>> example (common in such code) >> >> Then >> >> * you still want linting in the source language. > > Possibly. I don't care too much about that either. In my stuff, I do > very little in the way of advisory reports, which are only enabled > infrequently. > > But the context here is using linting to warn about things that are a > consequence of C's design, such as switch 'break' that is the subject of > the thread. > > I prefer to deal with that with a better language design. Are you making a "new" C?[...]
Technical Details
Message-ID:
<11a6c92$38ago$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-mailReferences:
<119qf6l$2rmg3$1@dont-email.me> <119r8u3$34nce$1@dont-email.me> <119rau4$35ugq$1@dont-email.me> <119uo2c$3kc0t$1@paganini.bofh.team> <119uqnv$d6j2$1@dont-email.me> <20261005143559.157@kylheku.com> <11a1arj$1e8ks$1@dont-email.me> <20261006171259.512@kylheku.com> <11a5fa7$2sg9n$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: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Wed, 7 Oct 2026 14:06:41 -0700 Organization: A noiseless patient Spider Lines: 69 Message-ID: <11a6c92$38ago$1@dont-email.me> References: <119qf6l$2rmg3$1@dont-email.me> <119r8u3$34nce$1@dont-email.me> <119rau4$35ugq$1@dont-email.me> <119uo2c$3kc0t$1@paganini.bofh.team> <119uqnv$d6j2$1@dont-email.me> <20261005143559.157@kylheku.com> <11a1arj$1e8ks$1@dont-email.me> <20261006171259.512@kylheku.com> <11a5fa7$2sg9n$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 07 Oct 2026 21:06:42 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3418648"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2mqCjmyiDFpzG7Kx1bqcebj/uelM0/7M="; posting-host="9e5dad94c1931ab85b8ca42122ca3b99" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:cLZHbBv1NahA6UisIQOghkZNUWQ= sha256:KobXth+nsjOh9v215UOdbmZk3xjqxhl3zmLH92Pbs4M= sha1:IZWR3/cPiY2rUviMybDvZye//+E= sha256:lP7h2Fl2pKZf1rE9uh7y+CwPaUn7hNwuIVamwUyhw4o= Content-Language: en-US In-Reply-To: <11a5fa7$2sg9n$1@dont-email.me>