From: "John Levine" <johnl@taugh.com>
To: tuhs@tuhs.org
Cc: luther.johnson@makerlisp.com
Subject: [TUHS] Re: C history question: why is signed integer overflow UB?
Date: 15 Aug 2025 14:44:08 -0400 [thread overview]
Message-ID: <20250815184408.E438DD7D00B1@ary.qy> (raw)
In-Reply-To: <e1a46242-a9e6-a580-9f05-994e76262f50@makerlisp.com>
It appears that Luther Johnson <luther.johnson@makerlisp.com> said:
>-=-=-=-=-=-
>
>I hear and understand what you're saying. I think what I'm trying to
>point out, is that in C, as it was originally implemented, in
>expressions "a + b", "a >> 1", "++a", C "does what the machine does".
We just had the same argument in comp.arch and came to largely the same
conclusion. While overflow behavior on any particular machine may be
predictable, there's no consistency from one machine to another,
particularly back when there were still one's complement machines
where people compiled C code (some of the Univac mainframes.)
It isn't all that predictable even on a single machine. I know several
where overflow might or might not trap depending on a program-settable
status bit.
R's,
John
next prev parent reply other threads:[~2025-08-15 18:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 17:17 [TUHS] C history question: why is signed integer overflow UB? Dan Cross
2025-08-15 17:31 ` [TUHS] " Luther Johnson
2025-08-15 17:36 ` Luther Johnson
2025-08-15 18:03 ` Warner Losh
2025-08-16 6:01 ` Lars Brinkhoff
2025-08-15 18:02 ` Nevin Liber
2025-08-15 18:25 ` Luther Johnson
2025-08-15 18:44 ` John Levine [this message]
2025-08-15 21:04 ` Douglas McIlroy
2025-08-15 21:59 ` Dave Horsfall
2025-08-15 23:58 ` Luther Johnson
2025-08-17 2:25 ` Clem Cole
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250815184408.E438DD7D00B1@ary.qy \
--to=johnl@taugh.com \
--cc=luther.johnson@makerlisp.com \
--cc=tuhs@tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).