Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #401211

Re: Constants and undefined behavior

Path csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: Constants and undefined behavior
Date Sat, 15 Aug 2026 07:58:11 -0700
Organization A noiseless patient Spider
Lines 48
Message-ID <8633wf5t30.fsf@linuxsc.com> (permalink)
References <10v7b32$2u85v$1@dont-email.me> <86tsrc8d0b.fsf@linuxsc.com> <1108pb9$omm$1@reader1.panix.com> <86ldcm82ql.fsf@linuxsc.com> <110cpca$gl2$1@reader1.panix.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Date Sat, 15 Aug 2026 14:58:12 +0000 (UTC)
Injection-Info dont-email.me; logging-data="3635087"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19okSTvha1CvamyYzQIIBbrPcZgkClgr6A="; posting-host="f88cfb7384c39afe54609bf3101f3803"
User-Agent Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock sha1:9j6ssL/RKgwUqNsu8SFLq+y1wlA= sha1:JKbb7v4+3UR3EAOYOWX7o1nCEXk= sha256:lrSvS/DtCUh3iSNTQLg7v7vvHJRi4Ghz/GfvSkvsbvE= sha1:iyF68mEMR3XIAjFKj5eZ9kMBWN0= sha256:vhcLzHgNSxHebIrwOKCU27dTfPp+PwCvZnponzX/g70=
Xref csiph.com comp.lang.c:401211

Show key headers only | View raw


cross@spitfire.i.gajendra.net (Dan Cross) writes:

> In article <86ldcm82ql.fsf@linuxsc.com>,
> Tim Rentsch  <tr.17687@z991.linuxsc.com> wrote:
>
>> cross@spitfire.i.gajendra.net (Dan Cross) writes:
>>
>>> In article <86tsrc8d0b.fsf@linuxsc.com>,
>>> Tim Rentsch  <tr.17687@z991.linuxsc.com> wrote:
>>> [...]
>>>
>>>> The C standard doesn't need to say that, for example, a
>>>> function x() other than main(), whose name is never referenced,
>>>> will never be called.  If someone wants to establish that x() could
>>>> be called, there needs to be a chain of reasoning going through the
>>>> semantic descriptions given in the C standard, to show that a call
>>>> to x() could occur.
>>>
>>> Actually, no, a reference to a function is not necessary.  A
>>> couple of years ago, a well-publicized issue in a C++ compiler a
>>> couple of years ago was something along the lines of this:
>>> [...]
>>
>> This is comp.lang.c.  My comments were only about C, and not
>> about C++.  But of course you already knew that.
>
> I see you did not read the other messages in the (sub)thread,
> but ok, here it is again, in C:
>
> ```
> term% cat what.c
> #include <stdio.h>
> int main(void) { for (unsigned int k = 0; k != 1; k += 2); return 0; }
> void hello(void) { printf("Hello, World!\n"); }
> term% clang --version | sed 1q
> clang version 22.1.6
> term% clang -Wall -pedantic -pedantic-errors -O1 -std=c23 -o what what.c
> what.c:2:58: warning: for loop has empty body [-Wempty-body]
>   2 | int main(void) { for (unsigned int k = 0; k != 1; k += 2); return 0; }
>     |                                                          ^
> what.c:2:58: note:  put the semicolon on a separate line to silence [...]
> 1 warning generated.
> term% ./what
> Hello, World!
> term%
> ```

This is a childish argument.

Back to comp.lang.c | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Constants and undefined behavior Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-08-15 07:58 -0700
  Re: Constants and undefined behavior cross@spitfire.i.gajendra.net (Dan Cross) - 2026-08-18 20:28 +0000

csiph-web