From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_ZEN_BLOCKED_OPENDNS,URIBL_DBL_BLOCKED_OPENDNS, URIBL_ZEN_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=3.4.4 Received: from minnie.tuhs.org (minnie.tuhs.org [IPv6:2600:3c01:e000:146::1]) by inbox.vuxu.org (Postfix) with ESMTP id 82A20278E9 for ; Fri, 15 Aug 2025 23:04:25 +0200 (CEST) Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 1533843C09; Sat, 16 Aug 2025 07:04:16 +1000 (AEST) Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by minnie.tuhs.org (Postfix) with ESMTPS id D057343C07 for ; Sat, 16 Aug 2025 07:04:08 +1000 (AEST) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-55ce528a0f5so2401965e87.3 for ; Fri, 15 Aug 2025 14:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dartmouth.edu; s=google1; t=1755291847; x=1755896647; darn=tuhs.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Dv/RPdhpM4sTNcHnQ3D0Y48cbgjVK73Zx+YTDEivgAc=; b=qmKlDMukSopeu6aA1cMAqWeY+daxk0NdyqK2CPQEKgnYFCCCE5ox/V69uSP8EuhG7U cDHlkCUi9MPojVJWdive0lg6dUBi2Ca0plMlY54kjMpSJr7DUFo2M46png0iw29NeC/+ TlRMWn3a026NMp4yA4Z0qMSy28nWUhrgjt2b/fdBn6np7POVQm8AzmeIfTGvfQzEtLL0 rRk658DJJUYDkVzrMjBzKRbHmhdOa+Z2trIhUz0mRADFLY7qoRKI6B5xZqwfo/o4wVZR PYlsULeP9VnUbXy/1Rm3zV1BqLgWWJgpesA1gtOiCH96R3Kh9SRAFp3V/MO14sR0Jgky FQrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755291847; x=1755896647; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dv/RPdhpM4sTNcHnQ3D0Y48cbgjVK73Zx+YTDEivgAc=; b=cRxJ21cP8/OlxNwz4CmRvN1FkRYQVkeXi374ab3b9KmtJOC4323ckcIfXZL3hzTawQ 0KKdMsrW/8xb1dTQUn2JTZhNGRiodVYYP0HeHx5sfxZ9pj0crtToe3VADa61hQta+xST xUkWUBH+8o04fq2eDyVWs4hGfxPK7N+QCUpuYIlcsaTgEr2ckf2k4c4BoFdHGpsTwrqI oVfJjsv7T4UDaWg45HJ8tnC8ZRmNEJ6NF87z/oOkyuD8L7QN5v/CkbitZMCC1PO7xOgu DDbA3fQOEqRXrgb0RcvFBRK3yadlxUc3LBGQQ7/6t7ZuRfrX3yv+KyYA+XEq7RwE2n2k PNrA== X-Gm-Message-State: AOJu0Yz9XRzOb5a4gLrGPkfUuC39RBKg54ZDZSmC6VcdY9A8QL6k3QsS ecUu5LOfXOsOrZAzxXN8iWh1hsDnOSDD98lu6bEjmJBJO8DxlCVKpbbjoGHrWjZ26VD8+OGrHy7 o+n4VDKUgaZIOhty8r77T6w911WQEB/9R0E2CFKO/Ng== X-Gm-Gg: ASbGnctdDnN6H1+GpNn6lL4ei4p7/+eflgIfmb3pBo1viAwA0YUT0st2YIHR8L9Fjz2 /ynlcnLJqTeWbXhK0Mw5iAd/N8+g0B3NkEzhaYr8ToDv1wZbWlLX77TmPoU52DQcOow0oplarZd ac+9cgOKp3Ka3SDgYvZ8h66blj4J3DhTZrcaNTil4f/5J954q6geIVN4+Zcnlm5kvki7pT6v+uw h2s0MJ/hFLLzZWG X-Google-Smtp-Source: AGHT+IGRYVqkx+FJsrLBrxApvSWVHgn1g4iXpvS6PKVr6XHkcV72ejsRjpD6RWeo0UNpSx3r2jeU6HuD2f/LLsdyJXc= X-Received: by 2002:a05:6512:4488:b0:558:f9af:7b71 with SMTP id 2adb3069b0e04-55ceea3fc04mr961813e87.5.1755291847009; Fri, 15 Aug 2025 14:04:07 -0700 (PDT) MIME-Version: 1.0 References: <664f1cf9-ae56-11a5-1e94-f58e0ca23565@makerlisp.com> <20250815184408.E438DD7D00B1@ary.qy> In-Reply-To: <20250815184408.E438DD7D00B1@ary.qy> From: Douglas McIlroy Date: Fri, 15 Aug 2025 17:04:09 -0400 X-Gm-Features: Ac12FXwg8zMfD5keVaeXJizgl2i5k7Q1k3k0o2cbd2yqfOpqvZy-9sCBtHc4sHk Message-ID: To: John Levine Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FUOHM5PSC4DCI6NH7PQRVUYWIJEHV2S6 X-Message-ID-Hash: FUOHM5PSC4DCI6NH7PQRVUYWIJEHV2S6 X-MailFrom: douglas.mcilroy@dartmouth.edu X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tuhs.tuhs.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: tuhs@tuhs.org, luther.johnson@makerlisp.com X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: C history question: why is signed integer overflow UB? List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Idle thought; There's been mention of 1's complement. If overflow is UB because of that possibility, maybe =3D=3D0 should be, too! Doug On Fri, Aug 15, 2025 at 2:44=E2=80=AFPM John Levine wrote= : > > It appears that Luther Johnson said: > >-=3D-=3D-=3D-=3D-=3D- > > > >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