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, 10 May 2026 18:19:57 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <86se7yrbcy.fsf@linuxsc.com>
References: <10su8cn$am9i$1@dont-email.me> <10tls2u$39j7a$1@dont-email.me> <10tm49i$9d$1@reader1.panix.com> <10tn3so$3j8hc$1@dont-email.me> <10tnj8s$pnq$1@reader1.panix.com> <10tnmk6$3os5b$1@dont-email.me> <10tnnv1$3o0n8$2@dont-email.me> <10tntu0$3r6q3$1@dont-email.me> <865x4vrqgu.fsf@linuxsc.com> <10tqp0l$ktbv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Mon, 11 May 2026 01:19:58 +0000 (UTC)
Injection-Info: dont-email.me; logging-data="834501"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0Xd3/eja+a/MsRSbr4zRzJ4nuywwi39M="; posting-host="e12ff559fd79fb3307443db8d47ea871"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:9PtJKLPpzUVBHrJCyIVx12ra5KY= sha1:WNX4AKoFTVsvW9HHNaGREk75bj8= sha256:nHlulrC1IBVSrb/OpziB/s3pI2xMSnaETpC1V+xVYN0= sha1:wN7Ru/J3ORjE9BHv4EPi8dohjGQ=
Xref: csiph.com comp.lang.c:398693
kalevi@kolttonen.fi (Kalevi Kolttonen) writes:
> Tim Rentsch wrote:
>
>> In almost all cases where uint8_t
>> might be used, unsigned char works just as well.
>
> Why "almost"? Where is the difference if any?
>
> As far as I know, ISO guarantees that
> sizeof(unsigned char) is always 1 byte.
>
> And operations on unsigned char are well defined,
> including wrap-around. So I fail to see any
> difference between unsigned char and uint8_t.
I respond downthread to your subsequent posting.