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: Mon, 11 May 2026 18:32:07 -0700 Organization: A noiseless patient Spider Lines: 13 Message-ID: <868q9ppg4o.fsf@linuxsc.com> References: <10su8cn$am9i$1@dont-email.me> <10tmhvb$19hk3$1@paganini.bofh.team> <10tn877$3kg8u$1@dont-email.me> <10todi7$3vl63$2@kst.eternal-september.org> <10togv8$b63$2@dont-email.me> <10tojpf$14cu$1@kst.eternal-september.org> <10tomsj$21gg$1@dont-email.me> <10toouo$2qt3$1@kst.eternal-september.org> <10tpos0$a6kp$2@dont-email.me> <10tr3aj$nfn3$2@kst.eternal-september.org> <10tr62r$nu2a$1@dont-email.me> <10trcac$1uosm$1@paganini.bofh.team> <10tsdom$11qhe$2@dont-email.me> <10tt9c0$2351k$1@paganini.bofh.team> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Tue, 12 May 2026 01:32:07 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1654897"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/IVhfSTJUejaosXFqYscmU+ozbOTi+Pb0="; posting-host="714746643ff61f997ea29d517f63563d" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:N2f6RgxoITOB72To2tzBTnzcJIY= sha1:+q39PvTvpTYAE/FdzfnL4ozV9Og= sha256:G+KlYYK5rgPre9ayPJd1Fc7yHtfBJ9egFDKbfpuLl70= sha1:Y2aakTb6xReYBsbe9gA+eqzWXGM= Xref: csiph.com comp.lang.c:398793 antispam@fricas.org (Waldek Hebisch) writes: [discussing the notion of "safe" programs] > As I wrote, safety is about ability to avoid or detect errors. In the functional programming community the usual statement is "Well-typed programs cannot go wrong." I think a good way of understanding this is that, if a program stays inside the safe limits of the language, the program can produce wrong answers, but it cannot produce meaningless answers. Of course, that has nothing to do with failing hardware, etc.