| Deutsch English Français Italiano |
|
<vr797c$2cr9u$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: olcott <polcott333@gmail.com>
Newsgroups: comp.theory,comp.lang.c,comp.lang.c++
Subject: Every sufficiently competent C programmer knows --- original post
appended at end
Followup-To: comp.theory
Date: Sun, 16 Mar 2025 14:36:11 -0500
Organization: A noiseless patient Spider
Lines: 79
Message-ID: <vr797c$2cr9u$2@dont-email.me>
References: <vqntaq$1jut5$1@dont-email.me>
<473a9a152c792a48c83eea569551035994c9d04f@i2pn2.org>
<vqo72u$1l6i0$2@dont-email.me> <vqp3d2$1u13r$1@dont-email.me>
<vqpe5a$202b2$3@dont-email.me> <vr699j$1js2s$1@dont-email.me>
<vr6c13$1lvq2$1@dont-email.me> <877c4owze2.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 16 Mar 2025 20:36:13 +0100 (CET)
Injection-Info: dont-email.me; posting-host="07a083537033e8637263f61b76c22e15";
logging-data="2518334"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PyUPV/uYOwQICyvAtedEm"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:f03buaSb91ODdMyCLM3rAyDLlQM=
X-Antivirus: Norton (VPS 250316-4, 3/16/2025), Outbound message
X-Antivirus-Status: Clean
In-Reply-To: <877c4owze2.fsf@nosuchdomain.example.com>
Content-Language: en-US
Bytes: 3702
On 3/16/2025 2:26 PM, Keith Thompson wrote:
> Richard Heathfield <rjh@cpax.org.uk> writes:
>> On 16/03/2025 10:31, Mikko wrote:
>>> False. You didn't say that HHH is a C function. In particular, the
>>> code
>>> shown above does not say so.
>>
>> It scarcely qualifies as C.
>>
>> For example, it begins by a goto this code:
>>
>> __asm__("lea eax, DATA1");
>> __asm__("mov Aborted, eax");
>> __asm__("lea eax, DATA2");
>> __asm__("mov execution_trace, eax");
>> __asm__("mov eax, END_OF_CODE");
>> __asm__("mov End_Of_Code, eax");
>>
>> which any C compiler is free to reject.
>>
>> C99 introduced the asm keyword, but that's spelled asm, not __asm__,
>> and of course it's not a magic wand, so it can't make an inherently
>> unportable program work on every platform supported by C
>> compilers. C/370, for example, would have a fit.
>
> No, C99 didn't introduce the asm keyword. Both C90 and C99 (and all
> later editions) document the "asm" keyword as a common extension,
> but it's not in the list of keywords. K&R1 (1978) mentions that
> some implementations reserve "fortran" and "asm". A conforming C
> compiler must accept "asm" as an ordinary identifier.
>
> I don't think Olcott intends HHH to be fully portable C (assuming
> he knows what that means). In any case, his claims about "Every
> sufficiently competent C programmer" are ludicrous.
>
*Every sufficiently competent C programmer knows*
typedef void (*ptr)();
int HHH(ptr P);
void Infinite_Loop()
{
HERE: goto HERE;
return;
}
void Infinite_Recursion()
{
Infinite_Recursion();
return;
}
void DDD()
{
HHH(DDD);
return;
}
int DD()
{
int Halt_Status = HHH(DD);
if (Halt_Status)
HERE: goto HERE;
return Halt_Status;
}
When HHH correctly emulates N steps of the
above functions none of them can possibly reach
their own "return" instruction and terminate normally.
Since HHH does see that same pattern that competent
C programmers see it correctly aborts its emulation
and rejects these inputs as non terminating.
--
Copyright 2025 Olcott "Talent hits a target no one else can hit; Genius
hits a target no one else can see." Arthur Schopenhauer