Re: Can someone please verify the execution trace of this?

Liste des GroupesRevenir à cl c 
Sujet : Re: Can someone please verify the execution trace of this?
De : polcott333 (at) *nospam* gmail.com (olcott)
Groupes : comp.lang.c++ comp.lang.c
Date : 21. May 2024, 05:58:41
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v2h65i$e0lf$1@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
On 5/20/2024 9:23 PM, Keith Thompson wrote:
wij <wyniijj5@gmail.com> writes:
[...]
typedef int (*ptr)();  // ptr is pointer to int function
int H(ptr x, ptr y);
int D(ptr x)
{
   int Halt_Status = H(x, x);
   if (Halt_Status)
     HERE: goto HERE;
   return Halt_Status;
}
>
int main()
{
   H(D,D);
   return 0;
}
>
The code above does not compile:
 Yes, it does (as you acknowledge in a later post).
 This:
     typedef int (*ptr)();
defines "ptr" as an alias for a type that can be described in English
as "pointer to function returning int".  The empty parentheses
indicate that the function takes an unspecified but fixed number
and type(s) of arguments; this is an old-style declaration.
 (The C23 standard, not yet released, changes the semantics of empty
parentheses, causing the code to be invalid, but let's assume C17.)
 The function H is declared but not defined.  That doesn't prevent
the code from being *compiled*, but it does prevent it from being
*linked* to produce an executable program.  Perhaps a definition
of H has been presented in some other article, but I will not waste
my time hunting for it.
 Ignoring variadic functions like printf, every function call
must pass the appropriate number and types of arguments, matching
the parameters defined by the corresponding function definition.
(In some cases there can be implicit type conversions, but there
are no implicit conversions for arguments or parameters of function
pointer type.)  If a correct *prototype* (a function declaration that
specifies the types of all parameters) is visible, this is enforced
at compile time; failing to do so is a *constraint violation*,
requiring a compile-time diagnostic.  If no such prototype is
visible, violations of this rule need not be diagnosed, but result
in *undefined behavior*; the C standard says nothing about what
the program will do.
 I'll note that the code (declares and) defines the function D,
but never calls it.  The address of D is passed to H, but without
a definition of H we can't guess what it does with that address.
 It's possible to rewrite the code to (a) avoid the use of old-style
function declarations and (b) avoids any undefined behavior --
but without knowing or being able to guess just what the program
is supposed to do, I see no point in doing so.
 The main point is this: The function H is declared but never
defined, so it's impossible to create a running program from this
code, and impossible to guess what it's intended to do without more
information.  I will not make any assumptions about how H is meant
to be defined or consult other posts to find a definition.  I may or
may not follow this thread to see if any clarifications are posted.
 The code as presented is a valid C *translation unit*, but it is
not a valid *program*, and it has no behavior.
 
*That was a great review for c17 standards compliance*
I cannot provide the definition for H because I am asking about
the behavior of D simulated by H for the infinite set of H/D pairs.
H is required to correctly simulate 1 to N steps of D and this
may or may not involve H simulating itself simulating D in recursive
simulation.
I have two fully operational versions of H that run under Windows
and Linux. I am not asking about those.
H uses an x86 emulator to emulate the machine code of D and
H is capable of emulating itself emulating D.
typedef int (*ptr)();  // ptr is pointer to int function
00 int H(ptr p, ptr i);
01 int D(ptr p)
02 {
03   int Halt_Status = H(p, p);
04   if (Halt_Status)
05     HERE: goto HERE;
06   return Halt_Status;
07 }
08
09 int main()
10 {
11   H(D,D);
12   return 0;
13 }
Correct simulation requires correctly emulating the x86 instructions
of D in the order specified by the machine code of D and may include
correctly emulating the x86 instructions of H in the order specified
by the machine code of H.
I need to have experts in these two forums verify that no D correctly
simulated by *pure function* H can possibly reach its own final state
at line 06 and halt in N steps of correct simulation.
https://en.wikipedia.org/wiki/Pure_function#
I thought it was categorically impossible then Richard found a loophole
using static data. This new *pure function* requirement eliminates that
loophole.
--
Copyright 2024 Olcott "Talent hits a target no one else can hit; Genius
hits a target no one else can see." Arthur Schopenhauer

Date Sujet#  Auteur
18 May 24 * Can someone please verify the execution trace of this?137olcott
19 May 24 +- Re: Can someone please verify the execution trace of this?1Richard Damon
19 May 24 +* Re: Can someone please verify the execution trace of this?3Sam
19 May 24 i`* Re: Can someone please verify the execution trace of this?2olcott
19 May 24 i `- Re: Can someone please verify the execution trace of this?1jak
19 May 24 +* Re: Can someone please verify the execution trace of this?2Rosario19
19 May 24 i`- Re: Can someone please verify the execution trace of this?1olcott
19 May 24 +* Re: Can someone please verify the execution trace of this?127Bonita Montero
19 May 24 i`* Re: Can someone please verify the execution trace of this?126olcott
19 May 24 i +- Re: Can someone please verify the execution trace of this?1Richard Damon
20 May 24 i `* Re: Can someone please verify the execution trace of this?124Bonita Montero
20 May 24 i  `* Re: Can someone please verify the execution trace of this?123olcott
20 May 24 i   +* Re: Can someone please verify the execution trace of this?54Bonita Montero
20 May 24 i   i`* Re: Can someone please verify the execution trace of this?53olcott
20 May 24 i   i +* Re: Can someone please verify the execution trace of this?44Bonita Montero
20 May 24 i   i i`* Re: Can someone please verify the execution trace of this?43olcott
20 May 24 i   i i `* Re: Can someone please verify the execution trace of this?42Bonita Montero
20 May 24 i   i i  `* Re: Can someone please verify the execution trace of this?41olcott
20 May 24 i   i i   `* Re: Can someone please verify the execution trace of this?40Bonita Montero
20 May 24 i   i i    `* Re: Can someone please verify the execution trace of this?39olcott
20 May 24 i   i i     +* Re: Can someone please verify the execution trace of this?2Richard Harnden
20 May 24 i   i i     i`- Re: Can someone please verify the execution trace of this?1olcott
20 May 24 i   i i     `* Re: Can someone please verify the execution trace of this?36Chris M. Thomasson
20 May 24 i   i i      `* Re: Can someone please verify the execution trace of this?35olcott
20 May 24 i   i i       `* Re: Can someone please verify the execution trace of this?34Chris M. Thomasson
20 May 24 i   i i        +* Re: Can someone please verify the execution trace of this?13olcott
20 May 24 i   i i        i`* Re: Can someone please verify the execution trace of this?12Chris M. Thomasson
20 May 24 i   i i        i `* Re: Can someone please verify the execution trace of this?11olcott
20 May 24 i   i i        i  +- Re: Can someone please verify the execution trace of this?1Chris M. Thomasson
20 May 24 i   i i        i  +* Re: Can someone please verify the execution trace of this?3Chris M. Thomasson
20 May 24 i   i i        i  i`* Re: Can someone please verify the execution trace of this?2olcott
20 May 24 i   i i        i  i `- Re: Can someone please verify the execution trace of this?1Chris M. Thomasson
20 May 24 i   i i        i  `* Re: Can someone please verify the execution trace of this?6Chris M. Thomasson
20 May 24 i   i i        i   `* Re: Can someone please verify the execution trace of this?5olcott
20 May 24 i   i i        i    `* Re: Can someone please verify the execution trace of this?4Chris M. Thomasson
20 May 24 i   i i        i     `* Re: Can someone please verify the execution trace of this?3olcott
20 May 24 i   i i        i      `* Re: Can someone please verify the execution trace of this?2Chris M. Thomasson
20 May 24 i   i i        i       `- Re: Can someone please verify the execution trace of this?1Chris M. Thomasson
20 May 24 i   i i        `* Re: Can someone please verify the execution trace of this?20Chris M. Thomasson
20 May 24 i   i i         `* Re: Can someone please verify the execution trace of this?19olcott
20 May 24 i   i i          `* Re: Can someone please verify the execution trace of this?18Chris M. Thomasson
20 May 24 i   i i           `* Re: Can someone please verify the execution trace of this?17olcott
20 May 24 i   i i            `* Re: Can someone please verify the execution trace of this?16Chris M. Thomasson
20 May 24 i   i i             `* Re: Can someone please verify the execution trace of this?15olcott
20 May 24 i   i i              `* Re: Can someone please verify the execution trace of this?14Chris M. Thomasson
20 May 24 i   i i               `* Re: Can someone please verify the execution trace of this?13olcott
20 May 24 i   i i                `* Re: Can someone please verify the execution trace of this?12Chris M. Thomasson
20 May 24 i   i i                 +- Re: Can someone please verify the execution trace of this?1Chris M. Thomasson
20 May 24 i   i i                 `* Re: Can someone please verify the execution trace of this?10olcott
20 May 24 i   i i                  `* Re: Can someone please verify the execution trace of this?9Chris M. Thomasson
20 May 24 i   i i                   `* Re: Can someone please verify the execution trace of this?8Chris M. Thomasson
20 May 24 i   i i                    `* Re: Can someone please verify the execution trace of this?7olcott
20 May 24 i   i i                     +* Re: Can someone please verify the execution trace of this?5Chris M. Thomasson
20 May 24 i   i i                     i`* Re: Can someone please verify the execution trace of this?4olcott
20 May 24 i   i i                     i `* Re: Can someone please verify the execution trace of this?3Chris M. Thomasson
20 May 24 i   i i                     i  +- Re: Can someone please verify the execution trace of this?1Chris M. Thomasson
20 May 24 i   i i                     i  `- Re: Can someone please verify the execution trace of this?1olcott
20 May 24 i   i i                     `- Re: Can someone please verify the execution trace of this?1Chris M. Thomasson
20 May 24 i   i `* Re: Can someone please verify the execution trace of this?8Fred. Zwarts
20 May 24 i   i  `* Re: Can someone please verify the execution trace of this?7olcott
20 May 24 i   i   +* Re: Can someone please verify the execution trace of this?2Paavo Helde
20 May 24 i   i   i`- Re: Can someone please verify the execution trace of this?1olcott
20 May 24 i   i   `* Re: Can someone please verify the execution trace of this?4Bonita Montero
20 May 24 i   i    `* Re: Can someone please verify the execution trace of this?3olcott
21 May 24 i   i     `* Re: Can someone please verify the execution trace of this?2Fred. Zwarts
21 May 24 i   i      `- Re: Can someone please verify the execution trace of this?1olcott
21 May 24 i   +* Re: Can someone please verify the execution trace of this?35Sam
21 May 24 i   i`* Re: Can someone please verify the execution trace of this?34olcott
21 May 24 i   i `* Re: Can someone please verify the execution trace of this?33Sam
21 May 24 i   i  +* Re: Can someone please verify the execution trace of this?30olcott
21 May 24 i   i  i`* Re: Can someone please verify the execution trace of this?29Sam
21 May 24 i   i  i `* Re: Can someone please verify the execution trace of this?28olcott
21 May 24 i   i  i  `* Re: Can someone please verify the execution trace of this?27Chris M. Thomasson
21 May 24 i   i  i   `* Re: Can someone please verify the execution trace of this?26olcott
21 May 24 i   i  i    +- Re: Can someone please verify the execution trace of this?1Chris M. Thomasson
21 May 24 i   i  i    `* Re: Can someone please verify the execution trace of this?24Sam
22 May 24 i   i  i     `* Can D correctly simulated by H reach its own line 06 and halt?23olcott
22 May 24 i   i  i      +* Re: Can D correctly simulated by H reach its own line 06 and halt?7Chris M. Thomasson
22 May 24 i   i  i      i`* Re: Can D correctly simulated by H reach its own line 06 and halt?6Chris M. Thomasson
22 May 24 i   i  i      i `* Re: Can D correctly simulated by H reach its own line 06 and halt?5olcott
22 May 24 i   i  i      i  `* Re: Can D correctly simulated by H reach its own line 06 and halt?4Chris M. Thomasson
22 May 24 i   i  i      i   `* Re: Can D correctly simulated by H reach its own line 06 and halt?3olcott
22 May 24 i   i  i      i    `* Re: Can D correctly simulated by H reach its own line 06 and halt?2Chris M. Thomasson
22 May 24 i   i  i      i     `- Re: Can D correctly simulated by H reach its own line 06 and halt?1olcott
22 May 24 i   i  i      `* Re: Can D correctly simulated by H reach its own line 06 and halt?15Sam
22 May 24 i   i  i       +* Re: Can D correctly simulated by H reach its own line 06 and halt?5olcott
22 May 24 i   i  i       i`* Re: Can D correctly simulated by H reach its own line 06 and halt?4Sam
22 May 24 i   i  i       i `* Re: Can D correctly simulated by H reach its own line 06 and halt?3olcott
22 May 24 i   i  i       i  `* Re: Can D correctly simulated by H reach its own line 06 and halt?2Sam
22 May 24 i   i  i       i   `- Re: Can D correctly simulated by H reach its own line 06 and halt?1Tim Rentsch
22 May 24 i   i  i       `* Re: Can D correctly simulated by H reach its own line 06 and halt?9olcott
22 May 24 i   i  i        +* Re: Can D correctly simulated by H reach its own line 06 and halt?3olcott
22 May 24 i   i  i        i`* Re: Can D correctly simulated by H reach its own line 06 and halt?2tTh
22 May 24 i   i  i        i `- Re: Can D correctly simulated by H reach its own line 06 and halt?1Chris M. Thomasson
22 May 24 i   i  i        `* Re: Can D correctly simulated by H reach its own line 06 and halt?5Sam
22 May 24 i   i  i         `* Re: Can D correctly simulated by H reach its own line 06 and halt?4Bonita Montero
22 May 24 i   i  i          `* Re: Can D correctly simulated by H reach its own line 06 and halt?3olcott
22 May 24 i   i  i           `* Re: Can D correctly simulated by H reach its own line 06 and halt?2Sam
22 May 24 i   i  i            `- Re: Can D correctly simulated by H reach its own line 06 and halt?1Chris M. Thomasson
21 May 24 i   i  `* Re: Can someone please verify the execution trace of this?2Chris M. Thomasson
21 May 24 i   i   `- Can D simulated by any H possibly reach its own line 06 and halt?1olcott
21 May 24 i   +* Re: Can someone please verify the execution trace of this?31olcott
22 May 24 i   `* Partial function types2Tim Rentsch
20 May 24 `* Re: Can someone please verify the execution trace of this?3Marcel Mueller

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal