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: Sun, 03 May 2026 20:33:16 -0700
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <86cxzbyhkz.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> <10t7bel$2rr3t$1@dont-email.me> <10t7g3r$2srmg$1@dont-email.me> <10t87hu$3ar8l$1@paganini.bofh.team>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Mon, 04 May 2026 03:33:17 +0000 (UTC)
Injection-Info: dont-email.me; logging-data="3548936"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yTPnZIs2zq8kfOxnP14gwsD8P9i5Pkgo="; posting-host="a1e35ddd35ce451998c695505411656f"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:C7kEdxJAVU60hjQqxH9OkZvka6g= sha1:QlNQFsDBhDY8FnHPiH6xaNz9J+g= sha256:mkwRoJcXLs/A7LzgwNyyMNmQOG7mgOXMTvSBEHVD5/0= sha1:g1OkE237VxLejfxo+gMwmhuufAk=
Xref: csiph.com comp.lang.c:398272
antispam@fricas.org (Waldek Hebisch) writes:
> Bart wrote:
[...]
>> So UB can also just mean implementation-defined?
>
> UB and implementation-defined defined are terms from C standard
> and standard makes them mutualy exclusive. Specific cases of
> UB may be defined by implementation, but "defined by implementation"
> is not the same as "implementation-defined". The first say just
> what some implementation decided to do, the second says what
> C standard requires (affecting _all_ compliant implementations).
Thank you for giving this explanation. It saved me the trouble
of providing a similar answer.