Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #401211
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Constants and undefined behavior |
| Date | 2026-08-15 07:58 -0700 |
| Organization | A noiseless patient Spider |
| 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> |
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 | Next — Next in thread | Find similar | Unroll 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