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: Thu, 14 May 2026 08:13:22 -0700 Organization: A noiseless patient Spider Lines: 13 Message-ID: <86lddmhvn1.fsf@linuxsc.com> References: <10su8cn$am9i$1@dont-email.me> <10tvefc$1vmna$2@dont-email.me> <10tvilu$u8$1@reader1.panix.com> <10tvmp7$23t17$1@dont-email.me> <10tvqcu$g53$1@reader1.panix.com> <10u1mav$1l93k$15@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 14 May 2026 15:13:22 +0000 (UTC) Injection-Info: dont-email.me; logging-data="506287"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VsSOXJsTw78JPTsd6H9cybCVKJxDGEtQ="; posting-host="d527bc7f7e7e084b0e2324cbe71ceb59" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:eT8syix3Ry5mVfaaUNlnKXmdGjE= sha1:zfRPKE9QG3dmOrSW++A4jzjHf+o= sha256:RNm/HqOQVoyKgc3wp2/+KF6AzF6PDRboSxCRbNIakME= sha1:SQvUK0+37Fukqvl6o++tHfmZwOk= Xref: csiph.com comp.lang.c:398948 Janis Papanagnou writes: > On 2026-05-12 20:09, Dan Cross wrote: > >> [...] one of the major motivating >> factors for using unsigned arithmetic in practice is to have the >> full bit-range of the type available. [...] > > Hmm.. - I'm using 'unsigned' typically to express the domain of the > application values (not to "wrest" some more values out of a type). I concur. I use unsigned types a lot more often than signed types, and needing an extra one bit of range is almost never a factor.