Re: What is the Result from Invoking this Halt Function?

From: Martin Shobe (mshobe_at_sbcglobal.net)
Date: 08/18/04


Date: Wed, 18 Aug 2004 11:52:41 GMT

On Wed, 18 Aug 2004 04:41:59 GMT, Marc Goodman
<marc.goodman@comcast.net> wrote:

>Joe Hendrix wrote:
>> You are redefining your claim. You claimed that code proved that
>> reflection was possible in standard C (by reflection I mean the ability
>> of a program to inspect it's own code at runtime). I merely pointed out
>> that your example was not Standard C, so it is not a counterexample.
>
>You're exactly right. The point I was missing was that Standard C
>is different from standard C. For me, "standard C" is whatever
>compiles with a standard C compiler like gcc and runs on a
>standard computer like a PC with Linux. "Standard C," on the
>other hand, refers to a programming language standard as spec'ed
>out by a standards organization and is an entirely different
>kettle of fish.
>
>I acknowledge that you are probably right that there is no method
>in "Standard C" to cast a function pointer to an int pointer and
>to dereference that pointer. Please take me the last little way
>to the end and cite a URL that states this is forbidden/illegal/etc.
>I ask this not because I disagree with your point but because
>I would like the opportunity to educate myself.

It's not forbidden. It's undefined. The compiler can *technically*
do *anything* with it and still meet the standard. That includes the
reasonable things like not compiling it, or what your compiler did, to
the unreasonable, like reformatting your hard drive.

>
>> Obviously, there are languages that support reflection (Java, Lisp,
>> Prolog, plus many more), but I suspect that Standard C is not one of
>> them and in fact was intentionally designed not to support reflection.
>>
>> Since any programming language I know supporting reflection is provably
>> Turing complete (ignoring resource limits), I don't think this affects
>> the halting problem, but that's not really a subject I'm going to post
>> anything (else) about.
>
>I agree completely with the last statement. Since it can be implemented
>in _non_ standard C, you either have to argue that a PC running gcc and
>linux is more powerful than a Turing Machine (which is clearly wrong)
>or that adding reflection does not increase the computational power
>of the model.

And the answer is, it doesn't increase the computational power of the
model. You can compute the same things by providing that information
as input.

Martin



Relevant Pages

  • Re: What is the Result from Invoking this Halt Function?
    ... >> reflection was possible in standard C (by reflection I mean the ability ... >> that your example was not Standard C, so it is not a counterexample. ... The compiler can *technically* ... >> them and in fact was intentionally designed not to support reflection. ...
    (sci.logic)
  • Re: What is the Result from Invoking this Halt Function?
    ... >> reflection was possible in standard C (by reflection I mean the ability ... >> that your example was not Standard C, so it is not a counterexample. ... >to dereference that pointer. ... So if you want to demonstrate something that uses introspection on the ...
    (comp.theory)
  • Re: What is the Result from Invoking this Halt Function?
    ... >> reflection was possible in standard C (by reflection I mean the ability ... >> that your example was not Standard C, so it is not a counterexample. ... >to dereference that pointer. ... So if you want to demonstrate something that uses introspection on the ...
    (sci.logic)
  • Re: Toward an Introspection Open Standard
    ... reflection as an area of keen interest at the recent standards committee ... People need to write proposals which are detailed ... maybe a reflection facility will make it into the next standard. ...
    (comp.lang.cpp)
  • Re: Is C99 the final C? (some suggestions)
    ... > that someone will try compile their stuff on an old compiler. ... > because the ANSI standard obsoleted them, and everyone picked up the ANSI ... fixed by using another language. ... >>are multiplying two expressions of the widest type supported by your ...
    (comp.lang.c)