🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #839

Re: Taming The Switch-Statement

#839
From: Chris M. Thomasson
Date: Tue, 27 Oct 2026 01:48
93 lines
5359 bytes
On 10/7/2026 3:31 PM, bart wrote:
> 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.

Why go after C... Make something better?



> 
> 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: <11bovsg$14rhk$2@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-mail
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> <11a6h8e$3a3g6$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: Mon, 26 Oct 2026 18:48:00 -0700
Organization: A noiseless patient Spider
Lines: 93
Message-ID: <11bovsg$14rhk$2@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>
 <11a6h8e$3a3g6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 27 Oct 2026 01:48:01 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1207860"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19JZ5jn13Co1BYq2Bp7M8tWb9YnL+XK7wk="; posting-host="a6c988641c9f0a5278d89ebf0389e645"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:QfgO+VjL18dpghdb3Y+zlEHNTEk= sha256:CO5AeyzChwMlAobeeFfmHtW7pjTPH9JUrdtFICFJBNY=
	sha1:9bjPYx9E3k/LvTid2ITnbnLj1H4= sha256:UVPswT5oQEiuDfEyiONwWYZvs5JUahFhAuI9o9uucKc=
In-Reply-To: <11a6h8e$3a3g6$1@dont-email.me>
Content-Language: en-US