🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #551

Re: Taming The Switch-Statement

#551
From: bart
Date: Mon, 19 Oct 2026 14:00
79 lines
4842 bytes
On 19/10/2026 09:46, Waldek Hebisch wrote:
> bart <bc@freeuk.com> wrote:
>> On 18/10/2026 15:27, David Brown wrote:
>>> On 18/10/2026 15:33, bart wrote:
>>>> On 18/10/2026 12:22, David Brown wrote:
>>
>>>>> To me, that is just as much gibberish as the original C.
>>>>
>>>> That doesn't matter - the problem is not even knowing what it represents.
>>>
>>> That is, shall we say, a strange attitude.  Gibberish (since that seems
>>> to be the preferred term here) is gibberish, no matter the language or
>>> representation, and is equally meaningless and useless.
>>
>> 'Gibberish' here refers to the representation, whether the type being
>> described is made-up nonsense or real.
>>
>> You may want to know what some complex type is for many reasons, you
>> don't necessarily need to understand what it means or why it was used.
>>
>> (For example I might come across a type in a C API that I want to
>> convert to another language.)
> 
> You say that you had commercial product, but you are apparently not
> aware of basic marketing principles.  You do not win in the market
> by making easy switch from your product to competitor product.  You
> may want to make it easy to switch _to_ your product.  But you want
> to make switching to competing products as hard as possible.  Of
> course there are constraints on this, in the process you do not want
> to deteriorate quality of your product too much and you have finite
> development resources.
> 
> Judging on this criteria you should admit that C is pretty good:
> people wrote translators from various languages to C, but there
> seem to be no success story going in opposite direction.

There are lots of reasons why not.

C is popular as a compiler target because it is lower level than the 
source language. It has a weak type system which is easy to circumvent.

It has 'goto'! (Many languages don't)

There are well established, ubiquitous optimising compilers for it.

Now, what would be the reasons for going the other way? There aren't any!

(Well, some languages may have a feature to translate C programs into 
their syntax so that development can proceed in the new language. But 
the start point here is not C code being used for development, with some 
other HLL as an intermediate form.)

So for that purpose, C is probably the most practical of current HLLs.

Even if it is still not ideal and there are features which are awkward 
to express as C. C's UBs also get in the way.

I've tried several times myself both with high-level and low-level 
generated C.

(However, as a target language, I recently tried my own for that 
purpose, and it worked perfectly! Some features such as out-of-order 
definitions made it easier than C.

Of course, my product does not have optimising compilers and very 
limited targets, due to not having an army of 1000s taking care of that 
as happens with C.

But it shows that the creating such a suitable language design is not hard.)


>  C++
> managed to take over nontrivial part of market previously occupied
> by C, but they did this by embedding largish subset of C and by
> massvie pileup of extra features.

So why IS C still around given that C++ compiler can build C programs, 
more or less?
Technical Details
Message-ID: <11b57p2$246h2$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-mail
References: <119qf6l$2rmg3$1@dont-email.me> <11arjmc$2qid7$1@dont-email.me> <11at5vi$5vu$1@reader2.panix.com> <11auad0$3no1k$1@dont-email.me> <11aupfl$3ul$1@reader2.panix.com> <11avmfb$55rt$1@dont-email.me> <11b2a6d$131h6$1@dont-email.me> <11b2hr6$15thq$1@dont-email.me> <11b2l06$16mof$1@dont-email.me> <11b2qv0$19h68$1@dont-email.me> <11b4le0$4fik$1@paganini.bofh.team>

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: Mon, 19 Oct 2026 15:00:03 +0100
Organization: A noiseless patient Spider
Lines: 79
Message-ID: <11b57p2$246h2$1@dont-email.me>
References: <119qf6l$2rmg3$1@dont-email.me> <11arjmc$2qid7$1@dont-email.me>
 <11at5vi$5vu$1@reader2.panix.com> <11auad0$3no1k$1@dont-email.me>
 <11aupfl$3ul$1@reader2.panix.com> <11avmfb$55rt$1@dont-email.me>
 <11b2a6d$131h6$1@dont-email.me> <11b2hr6$15thq$1@dont-email.me>
 <11b2l06$16mof$1@dont-email.me> <11b2qv0$19h68$1@dont-email.me>
 <11b4le0$4fik$1@paganini.bofh.team>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 19 Oct 2026 14:00:03 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2234914"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18t64RNLUgAOH5R0tvYvXIW"; posting-host="490a98fc4950ca5dcdd86ea57e554712"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:FTD+VgM2eGsy8ltz9EtcS8+QwzA= sha256:tjIZK/O2smPut2qHZE3pAcoiMtkqndP2zaApabcxkzI=
	sha1:v+jjslnZXHa3FlDCjgbt4cPkVd4= sha256:1+zNbCkKLQfF7rUXqBuu/LQoHGpvr+UgLF29trXYJVM=
Content-Language: en-GB
In-Reply-To: <11b4le0$4fik$1@paganini.bofh.team>