Re: Disproof of the Halting Problem's Conclusion

stephen_at_nomail.com
Date: 07/24/04


Date: 24 Jul 2004 16:36:14 GMT

In comp.theory Peter Olcott <olcott@worldnet.att.net> wrote:

: "Marc Goodman" <marc.goodman@comcast.net> wrote in message news:mCqMc.175385$Oq2.78595@attbi_s52...
:>
:> True, it's not the only possible way to construct a halt analyzer.
:> False that you can construct a halt analyzer that doesn't return
:> its value.

: Why the hell not? It is by no means at all impossible to
: write a function that does not return a value to its caller.
: This is a standard feature of many programming languages.

Neither is it by no means at all impossible to modify a function
that prints its output to the screen to return it to the caller.

You are claiming you can write a function f1

void f1(int x)
{
    int y;
    //
    // code to evaluate y
    //
    cout << y << endl;
}

but that it is impossible for us to write the function f2

int f2(int x)
{
    int y;
    //
    // code to evaluate y
    //
    return y;
}

Changing the cout to a return is not going to change the
logic of the program. Anything that can be calculated by f1
can be calculated by f2. The following program will print the
same value twice, no matter what the 'code to evaluate y' is.

int main()
{
        f1(10);
        cout << f2(10) << endl;
}

Stephen



Relevant Pages

  • Re: Disproof of the Halting Problems Conclusion
    ... In comp.theory Peter Olcott wrote: ... it's not the only possible way to construct a halt analyzer. ... that prints its output to the screen to return it to the caller. ... int f2 ...
    (comp.theory)
  • Re: not returning anything to non void function
    ... Only if the caller attempts to use the result. ... int foo{ ... The standard *could* have been written to allow this. ... If English isn't your first language, or even if it is, nobody is ...
    (comp.lang.c)
  • Re: value returned from a function
    ... function whose return type is void. ... int main ... unsigned char, the caller could safely use the value, since unsigned ...
    (comp.lang.c)
  • Re: string compare
    ... short int length; ... char data; ... You can have the caller of the library routines specify which type ... Well what if someone wants to compare a short string with a long ...
    (comp.lang.c)
  • Re: function not returning a value
    ... behave very differently than Nick's ... If the caller doesn't use the result, ... int main ... equivalent to executing a return statement without an expression. ...
    (comp.lang.c)