Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #401211 > unrolled thread
| Started by | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| First post | 2026-08-15 07:58 -0700 |
| Last post | 2026-08-18 20:28 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.c
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Date | 2026-08-15 07:58 -0700 |
| Subject | Re: Constants and undefined behavior |
| Message-ID | <8633wf5t30.fsf@linuxsc.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.
[toc] | [next] | [standalone]
| From | cross@spitfire.i.gajendra.net (Dan Cross) |
|---|---|
| Date | 2026-08-18 20:28 +0000 |
| Message-ID | <1162f9a$i2e$1@reader1.panix.com> |
| In reply to | #401211 |
In article <8633wf5t30.fsf@linuxsc.com>,
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
>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.
Well, your response certainly is.
- Dan C.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c
csiph-web