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: Sat, 02 May 2026 16:52:59 -0700 Organization: A noiseless patient Spider Lines: 8 Message-ID: <86se89xtb8.fsf@linuxsc.com> References: <10su8cn$am9i$1@dont-email.me> <10sv4v0$h9mn$1@dont-email.me> <84c1c180f4d5b96259a631bdb09b6054b4eb44d2.camel@gmail.com> <10svgfv$l2bu$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> <10t55r6$28suo$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sat, 02 May 2026 23:52:59 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2663530"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18iqirfNpXkhXguHEti5h2xR8F8bvcUHLE="; posting-host="0224f8b6fcff9256362aa20147bea6bc" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:xay8e1+/UUf0eBPFDt5lDM+o98g= sha1:e+6gR77yFQnBuhsUt47qX+TXwPw= sha256:I3blZEA6KZZeu++eehzuro3WodMxURkpRs/gV7jsebM= sha1:oCS3nEI02iZJpY0dEpsOnrrEOW8= Xref: csiph.com comp.lang.c:398200 Bart writes: > I'd like to know why C is OK with modular arithmetic for unsigned > but not signed integers. If the latter depended on the hardware, > then why wasn't it just implementation defined? This sounds like a rhetorical question. Do you know so little about the history of computer hardware?