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: Constants and undefined behavior
Date: Sat, 06 Jun 2026 15:47:07 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <86v7bv9thw.fsf@linuxsc.com>
References: <10v7b32$2u85v$1@dont-email.me> <865x3yd21n.fsf@linuxsc.com> <10vs997$rp5$1@reader1.panix.com> <10vsnl7$lkmu$1@kst.eternal-september.org> <10vt2un$fuu$1@reader1.panix.com> <10vt7b9$pi3s$1@kst.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Sat, 06 Jun 2026 22:47:08 +0000 (UTC)
Injection-Info: dont-email.me; logging-data="2263952"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5gmcfhLwOimgHzK4h9Zoe4uGvXQiGJwc="; posting-host="081e13a85c046e7c342399b4c0b9e54e"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:74biVR5+QG+vmhUc+FH22w+NORU= sha1:WpnOIZnz/iEacbVdmx2cj6KEEPY= sha256:EMFAU06T9bjCOXSkqgsBG7xGQmbqjrkeZjN0xM0sv2k= sha1:DTsoLVZBORlaXmPBAL5+F0tqG+A=
Xref: csiph.com comp.lang.c:399772
Keith Thompson writes:
> I claim that an expression that looks like a constant expression
> *isn't* a constant-expression if it doesn't appear in a context
> that requires a constant-expression.
Right. This question came up years ago in a Defect Report. The
response from the Committee was basically the same as what you
said: the 6.6 constraints for constant expressions apply only in
situations where the C standard expressly requires a constant
expression. (I don't have the DR in front of me; I'm summarizing
based on memory, but am confident the actual wording is consistent
with what I just said.)