Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Alternatives to C (was Re: Safety of casting from 'long' to 'int')
Date: Wed, 13 May 2026 16:33:11 -0700
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <861pfekhqg.fsf@linuxsc.com>
References: <10su8cn$am9i$1@dont-email.me> <10tof8a$b63$1@dont-email.me> <10tp26r$1l93l$21@dont-email.me> <10tpt9j$c3i4$1@dont-email.me> <10tpvqv$ivo$3@reader1.panix.com> <10ttvng$1j579$1@dont-email.me> <10tu082$1irrv$2@kst.eternal-september.org> <10u069d$285sv$1@dont-email.me> <10u0a0m$2a4nr$1@kst.eternal-september.org> <10u0k0k$1l93l$30@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Wed, 13 May 2026 23:33:12 +0000 (UTC)
Injection-Info: dont-email.me; logging-data="3179643"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GV0WZYW3uss+8TQ9Tv1QGxdxkR5N8joU="; posting-host="ace8b6eaa328dcf44f89a3207699c4cb"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:yV3QxP7nYw1xhZi87Rlvq1Ra2lI= sha1:Z3HcNsE4WQJFyKQqoZooclXLzMk= sha256:Sc4Ayv1dzLnBJAzi8qAlycmmAtjoORy4/HkpLRAF5Y8= sha1:BVxmmIWdgdAufpdUSjHrT9Ib1jA=
Xref: csiph.com comp.lang.c:398913
Janis Papanagnou writes:
> On 2026-05-13 00:35, Keith Thompson wrote:
>
>> [Dropping comp.lang.misc, since this is only about C.]
>> Bart writes:
>>
>>> [...]
>>
>> [...]
>>
>>> So the inconvenience of how 'switch' works is excused because
>>> /sometimes/ you need fallthrough, or the one time in a thousand you
>>> need Duff's device.
>
> I don't see any inconvenience in "how it works"; it actually
> allows programmers to implement both semantics as needed. And
> both semantics were needed, they have been used. (Even if you
> think your projection of your preferences and limited uses is
> what should constitute the global software development world.)
I don't use switch() very often. Out of curiosity I looked
through some source code that I worked on recently and checked
all the switch() statements. Out of roughly 10,000 lines of .c
files, there were
10 switch() statements, with
70 "arms" total (either non-trivial 'case's or 'default's)
9 duplicate labels (fallthrough with no extra actions taken)
13 breaks needed
So for this sample 'break;' and no 'break;' were roughly equally
common, and it was useful to have both.