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: Safety of casting from 'long' to 'int' Date: Sun, 07 Jun 2026 18:02:29 -0700 Organization: A noiseless patient Spider Lines: 82 Message-ID: <86ecihalp6.fsf@linuxsc.com> References: <10su8cn$am9i$1@dont-email.me> <86o6isuegr.fsf@linuxsc.com> <10tlh5r$9io$1@reader1.panix.com> <86a4u7s0lo.fsf@linuxsc.com> <10tqf5l$aup$1@reader1.panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Mon, 08 Jun 2026 01:02:30 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3032103"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XfO1IZWcgTlccGtS5t4Ptuq9GbkgCiUA="; posting-host="7034a20cec0df5a18a4342eb4e55c6f9" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:kAkfBcTxBh8noDsp8/Pm/ALEz/s= sha1:7bF6Q5xsSk5LXH/0RABfTA4dlI0= sha256:3Lo3vLcMJfc76cjJgvi830n6kMMGM8YvddgqZ/QkZyc= sha1:G04l7bN2ltKsACSOzZWHcCaEoRg= Xref: csiph.com comp.lang.c:399785 cross@spitfire.i.gajendra.net (Dan Cross) writes: > In article <86a4u7s0lo.fsf@linuxsc.com>, > Tim Rentsch wrote: > >> cross@spitfire.i.gajendra.net (Dan Cross) writes: >> >> [..I am summarizing parts in an effort to get to key aspects..] >> >>> In article <86o6isuegr.fsf@linuxsc.com>, >>> Tim Rentsch wrote: >>> >>>> [snip] >>>> It's important to understand the perspectives of different groups >>>> of participants in the C ecosystem. There are three main groups: >>>> >>>> If you're a programmer, you hate undefined behavior, and avoid it >>>> like the plague. >>>> >>>> If you're a compiler writer, you love undefined behavior, because >>>> it lets you do whatever you want. >>>> >>>> If you're a member of the ISO C standards committee (and I admit >>>> that to a degree I am speculating here), you think of undefined >>>> behavior as a balancing test, of needing to weigh the tensions >>>> inherent in what the first two groups would prefer. >>> >>> This, I think, is the tragedy of C ("tragedy" in the dramatic, >>> Shakespearean sense). >>> [long exposition on the history of C] >>> >>> My point here is that the users and developers of the language >>> were the same group, [elaboration] >>> >>> But, as you pointed out, this is no longer the case. The two are >>> now distinct, with very different goals. [a consequence of which >>> is C usage is less uniform (my paraphrase)] > > Here, I was referring to the _groups you defined_. > >>> I think this is fair: pretty much no production OS is written in >>> pure ISO C, if they're written in C at all: they all use compiler >>> flags or custom toolchains to enable various extensions and pin >>> down aspects of UB they depend on in one form or another. >>> >>> And this is the tragedy. This isn't how it started, and I don't >>> think the folks who created the language wanted it to go down this >>> way, but here we are. [rest omitted] >> >> I wouldn't call it a tragedy, in fact just the opposite. > > The tragedy I alluded to is that precisely the difference > between two groups you yourself suggested: programmers hate UB, > compiler writers love it. The compiler writers and programmers > often appear to have an antagonistic relationship. > >> If C had >> stayed in its original environment it never would have become as >> ubiquitous and widespread as it is today. The original ecosystem >> doesn't scale. By letting C, and also Unix, enter the public >> sphere, a great benefit accrued to the world at large. > > I said as much. > >> [snip] Moreover such non-standard >> language usages are not limited to C -- the Rust language is also >> used in the linux kernel, and there too some non-standard language >> features are used in kernel code. > > Rust has no language standard, so saying that "non-standard > language features are used in kernel code" is incorrect. > >> I don't mean to compare C and Rust. My position here is only that, >> in my view, the complaints raised about C are misplaced. Others >> are welcome to their own views on the subject. > > I don't think you read my note carefully, and your response is > to something I did not say. It may be that I didn't understand what you were trying to get at. But I did read your postings carefully, both the earlier one I responded to before and the one I am replying to now.