Ken Thompson的图灵论文中的自我复制程序 [英] Self-reproducing program in Ken Thompson's Turing paper
问题描述
Ken Thompson提到了一个自我复制程序,它在1983年的图灵论文中输出了源代码的完整副本,作为输出,
http://www.acm.org/classics/sep95/ 。这可以在C中完成吗?如何在运行时知道它的编译时源代码?
Ken Thompson mentioned a self-reproducing program that products an
exact copy of its source code as output in his 1983 Turing paper,
http://www.acm.org/classics/sep95/ . Can this be done in C? How can a
program at runtime know its compiling-time source code?
推荐答案
lovecreatesbea .. 。@ gmail.com< lo *************** @ gmail.comwrote:
lovecreatesbea...@gmail.com <lo***************@gmail.comwrote:
Ken Thompson提到了一个自我在1983年的图灵论文中,将产品的完整程序复制到其源代码的完整副本,
http://www.acm.org/classics/sep95/ 。这可以在C中完成吗?如何在运行时运行
程序知道它的编译时源代码?
Ken Thompson mentioned a self-reproducing program that products an
exact copy of its source code as output in his 1983 Turing paper,
http://www.acm.org/classics/sep95/ . Can this be done in C? How can a
program at runtime know its compiling-time source code?
当然。
#include< stdlib.h>
int main(void){
system(" links http://www.google.com"); / *在DS9K上,可以打开链接
到幽暗地域,当心* /
返回0;
}
肯定你经常发布在这里,知道你会得到STFW
来回答这个问题吗?在这个新闻组中,当然已经多次讨论了qu $
。
-
C. Benson Manica |我*应该*知道我在说什么 - 如果我
cbmanica(at)gmail.com |不,我需要知道。火焰欢迎。
Sure.
#include <stdlib.h>
int main( void ) {
system( "links http://www.google.com" ); /* On DS9K, may open "link"
to the Underdark, beware */
return 0;
}
Surely you''ve posted here often enough to know that you''ll get "STFW"
for an answer to this question? Certainly quines have been discussed
many times on this very newsgroup.
--
C. Benson Manica | I *should* know what I''m talking about - if I
cbmanica(at)gmail.com | don''t, I need to know. Flames welcome.
5月10日上午11:23,lovecreatesbea ... @ gmail.com
< lovecreatesbea。 .. @ gmail.comwrote:
On May 10, 11:23 am, "lovecreatesbea...@gmail.com"
<lovecreatesbea...@gmail.comwrote:
Ken Thompson提到了一个自我复制程序,它产生了一个
的源代码的精确副本作为输出在1983年的图灵论文中, http://www.acm.org/classics/sep95 / 。这可以在C中完成吗?
Ken Thompson mentioned a self-reproducing program that products an
exact copy of its source code as output in his 1983 Turing paper,http://www.acm.org/classics/sep95/. Can this be done in C?
天哪,我不知道。也许我应该进行网络搜索,或查看常见问题解答
或尝试运行
奇怪的代码,这些代码显示在人们的签名中。
Gosh, I don''t know. Maybe I should do a web search, or check the FAQ
or try to run the
strange looking code that shows up in people''s signatures.
运行时
程序如何知道其编译时源代码?
How can a
program at runtime know its compiling-time source code?
一般情况下它不能,但大多数程序都不能自我复制..
但是,鉴于运行时是一个源代码的功能,
也许吧
可以选择源代码,以便运行时
打印出这个源代码。也许我应该进行网络搜索,或者查看常见问题解答或者尝试运行
奇怪的代码,这些代码显示在人们的签名中。
-
William Hughes
10 LIST
In general it can''t, but most programs are not self-reproducing..
However, given that the runtime is a function of the source code,
maybe it
would be possible to choose the source code so that the runtime
prints out this source code. Maybe I should do a web search, or check
the FAQ or try to run the
strange looking code that shows up in people''s signatures.
--
William Hughes
10 LIST
5月10日16:23,lovecreatesbea ... @ gmail.com
< lovecreatesbea ... @ gmail.comwrote:
On 10 May, 16:23, "lovecreatesbea...@gmail.com"
<lovecreatesbea...@gmail.comwrote:
Ken Thompson提到了一个自我复制程序,它在1983年的图灵论文中输出了源代码的完整副本,作为输出, http://www.acm.org/classics/sep95/ 。这可以在C中完成吗?如何在运行时运行
程序知道它的编译时源代码?
Ken Thompson mentioned a self-reproducing program that products an
exact copy of its source code as output in his 1983 Turing paper,http://www.acm.org/classics/sep95/. Can this be done in C? How can a
program at runtime know its compiling-time source code?
http:// www .nyx.net /~gthompso / quine.htm
这篇关于Ken Thompson的图灵论文中的自我复制程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!