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 06:41:43 -0700 Organization: A noiseless patient Spider Lines: 12 Message-ID: <86pl3avuqw.fsf@linuxsc.com> References: <10su8cn$am9i$1@dont-email.me> <10taqml$3rhuc$2@dont-email.me> <10tau4a$3ueok$1@dont-email.me> <10tbg6g$2ls$2@reader1.panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Tue, 05 May 2026 13:41:44 +0000 (UTC) Injection-Info: dont-email.me; logging-data="455437"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DmvjO1KayAHS4jNmh4aSUEDLTzAlawac="; posting-host="3e8439ee7a5eb7f921cc930c7b47e195" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:J+JgUVyJKO8m3CicxPQBoyNO3X4= sha1:t/6XKWJAXcVVt2RomLyyUSL4HLc= sha256:TJk6v+bs7pwBrfqCk+jV74gMAHgfcAZFqwyPHdPwZNg= sha1:NbEfxQ/9XfPj+QlPUm3Axyeo8NM= Xref: csiph.com comp.lang.c:398370 cross@spitfire.i.gajendra.net (Dan Cross) writes: > [...] Or, something _can_ become UB that was not > initially; a program who took care to avoid UB in the ANSI C > sense might find their program suddenly stops working because a > thing they did became UB in a later revision of the standard > (e.g., `realloc(0, ...)` becoming UB in C23). Do you have another example? In my view the change related to realloc(0,...) is more a basis for condemning the decisions of people on the C23 committee than it is a basis for condemning the concept of undefined behavior.