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: Tue, 05 May 2026 09:53:53 -0700 Organization: A noiseless patient Spider Lines: 28 Message-ID: <86ik91x0f2.fsf@linuxsc.com> References: <10su8cn$am9i$1@dont-email.me> <10t4hse$22u36$1@dont-email.me> <97a1c40bf71cfe8edab25d5ac8a1ad435c3995e5.camel@gmail.com> <10t4tjd$25vb5$1@dont-email.me> <10t4viv$25van$2@dont-email.me> <10t5dn8$2aje4$1@dont-email.me> <10t64u6$36agp$2@paganini.bofh.team> <10t66eg$2houe$2@dont-email.me> <10t6bf2$36qnd$1@paganini.bofh.team> <10t79qb$2rcc9$1@dont-email.me> <10t8gdh$36t8v$2@kst.eternal-september.org> <10t8m1v$3989q$1@dont-email.me> <10t8sev$3h2jc$1@paganini.bofh.team> <10ta7fn$3mqnh$1@dont-email.me> <10taenk$3ou8g$1@dont-email.me> <10tbfd2$1gsnu$12@dont-email.me> <10tbl1g$40l5$1@kst.eternal-september.org> <10tcp9h$1gsnu$15@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Tue, 05 May 2026 16:53:53 +0000 (UTC) Injection-Info: dont-email.me; logging-data="615331"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JjJlDMEsaGgvbH1VQL4hO/+sCqINzK8c="; posting-host="3e8439ee7a5eb7f921cc930c7b47e195" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:FRYfoWYGZWT/ks91Lcpt+EVKNgE= sha1:sXxxhOX0+6Dhm7ggnOj5vW00Fa8= sha256:2WqPfThNU1b83FMXZl2XcxLjCbFWhNvEibWL8+I01NA= sha1:2A9fw7TenJ65IK62L58QX+4Zkp4= Xref: csiph.com comp.lang.c:398380 Janis Papanagnou writes: [...] > Incidentally, after my post, I read a paper (Wang et al.) that had > been mentioned recently.[*] > > I was not only astonished to read what you are also explaining here > to be fact in Standard-C, but I was rather frightened! - Compared > to many specific other languages I had never considered "C" to be > a "good" (for some specific, maybe subjective, values of good) or a > well designed language. But - if you look into the standardized, or > rather *non-standardized* details - things are even worse than I'd > have expected. 8-( > > > [*] One source is: > https://people.csail.mit.edu/nickolai/papers/wang-undef-2012-07-12.pdf Thank you for this link. I have have read these comments before, but it was good to read them (again). > For folks who haven't yet read it I'd suggest to read it; it's very > enlightening. (But also sort of a horror story.) I don't see it as a horror story. Maybe a cautionary tale. None of the examples are what I would call hard to understand, or difficult to remedy.