Article View: comp.lang.c
Article #51Re: Taming The Switch-Statement
From: bart
Date: Wed, 07 Oct 2026 22:31
Date: Wed, 07 Oct 2026 22:31
85 lines
5084 bytes
5084 bytes
On 07/10/2026 22:06, Chris M. Thomasson wrote: > 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?[...] I'm not making anything. I have long maintained a personal systems language which fixes most of my moans about C (and even deals with some of fir's needs, but those seem to change erratically). It would have been good for /someone else/ to have evolved C in a direction I'd have found useful, but current evolvement of C is not interesting to me and IMO misguided. Since I have my own solutions for the little coding I do now, this doesn't matter so much - let C aficionados be masochists if they want. But I am still interested in tooling (which has its own masochists!).
Technical Details
Message-ID:
<11a6h8e$3a3g6$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> <11a6c92$38ago$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: bart <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Wed, 7 Oct 2026 23:31:43 +0100 Organization: A noiseless patient Spider Lines: 85 Message-ID: <11a6h8e$3a3g6$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> <11a6c92$38ago$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 22:31:43 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3476998"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ynUPocqcIaP+G02YFbiCR"; posting-host="ddea08e9999a8df42a3f6de53c7cc773" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:o+pV4ovavC6TLDVG+rnmTH1XtmM= sha256:hK9eg1AYXzkMyWH9mACDvBOHbEDmspaXDoY9M3Skalo= sha1:CymT3ZRgaPxOEMBX6/uoStjf1M4= sha256:afTp9VGfTeu8UnVOfHH9TzOkOMKEl3NiaGZ4tGzJH/M= In-Reply-To: <11a6c92$38ago$1@dont-email.me> Content-Language: en-GB