奎因 [英] Quine

查看:90
本文介绍了奎因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我遇到了一个术语,它是Quine。


"在计算中,quine是一个程序(一种形式的metaprogram)

产生完整的源代码作为唯一的输出。为了娱乐,

黑客有时会尝试用任何给定的编程语言开发最短的quine。


任何人都可以解释一下它究竟意味着什么?是否有某人用自己定义的某种语言来定义。

Hi,
I have come across a term, it is Quine.

"In computing, a quine is a program (a form of metaprogram) that
produces its complete source code as its only output. For amusement,
hackers sometimes attempt to develop the shortest possible quine in
any given programming language."

Can anyone explain me what does it exactly mean? And is there
someone''s self defined quine for some language.

推荐答案



我遇到过一个术语,它是Quine。


"在计算中,quine是一个程序(a形式的元程序)

产生完整的源代码作为唯一的输出。为了娱乐,

黑客有时会尝试用任何给定的编程语言开发最短的quine。


任何人都可以解释一下它究竟意味着什么?是否有某人用自己定义的某种语言的quine。
I have come across a term, it is Quine.

"In computing, a quine is a program (a form of metaprogram) that
produces its complete source code as its only output. For amusement,
hackers sometimes attempt to develop the shortest possible quine in
any given programming language."

Can anyone explain me what does it exactly mean? And is there
someone''s self defined quine for some language.



该程序显示它的来源:


main(a){a =" main( a){a =%c%s%c; printf(a,34,a,34);}" ;; p rintf(a,34,a,34);}


将显示


main(a){a =" main(a){a =%c%s%c; printf(a,34,a,34); }" ;; p rintf(a,34,a,34);}


Best,

zaharije Pasalic

It is program that show it''s source:

main(a){a="main(a){a=%c%s%c;printf(a,34,a,34);}";p rintf(a,34,a,34);}

will display

main(a){a="main(a){a=%c%s%c;printf(a,34,a,34);}";p rintf(a,34,a,34);}

Best,
zaharije Pasalic


3月20日下午1点13分,pasalic.zahar ... @ gmail.com写道:

(>由单点写,参与线被剪断by> -

海报)
On Mar 20, 1:13 pm, pasalic.zahar...@gmail.com wrote:
(>written by singlepoint, atttribution line was snipped by >-
poster)



我有遇到一个术语,就是奎因。
Hi,
I have come across a term, it is Quine.


"在计算中,quine是一个程序(元程序的一种形式),

产生完整的源代码作为唯一的输出。为了娱乐,

黑客有时会尝试用任何给定的编程语言开发最短的quine。
"In computing, a quine is a program (a form of metaprogram) that
produces its complete source code as its only output. For amusement,
hackers sometimes attempt to develop the shortest possible quine in
any given programming language."


任何人都可以解释一下它到底意味着什么?是否有某人用自己定义的某种语言的quine。
Can anyone explain me what does it exactly mean? And is there
someone''s self defined quine for some language.



这是显示它来源的程序:


main(a){a =" main( a){a =%c%s%c; printf(a,34,a,34);}" ;; p rintf(a,34,a,34);}


将显示


main(a){a =" main(a){a =%c%s%c; printf(a,34,a,34); }" ;; p rintf(a,34,a,34);}


It is program that show it''s source:

main(a){a="main(a){a=%c%s%c;printf(a,34,a,34);}";p rintf(a,34,a,34);}

will display

main(a){a="main(a){a=%c%s%c;printf(a,34,a,34);}";p rintf(a,34,a,34);}



这不一定有效,因为''\'''''不一定等于

34.

这可能不会起作用,因为printf还没有宣布它和

使用可变长度的参数列表。


Google找到了我< http://www.madore.org/~david/computers/quine.html>,

包含看似严格符合C89标准的quine

(虽然它有一些假设ASCII更低)。

-

ais523

This won''t necessarily work, because ''\"'' isn''t necessarily equal to
34.
This probably won''t work, because printf hasn''t been declared and it
uses a variable-length argument list.

Google found me <http://www.madore.org/~david/computers/quine.html>,
which contains what appears to be a strictly-C89-conforming quine
(although it has some that assume ASCII lower down).
--
ais523


" ais523" < ai **** @ bham.ac.ukwrites:
"ais523" <ai****@bham.ac.ukwrites:

3月20日下午1点13分,pasalic.zahar ... @ gmail.com写道:

(>由单点写,参与线被剪切了> -

海报)
On Mar 20, 1:13 pm, pasalic.zahar...@gmail.com wrote:
(>written by singlepoint, atttribution line was snipped by >-
poster)

我遇到过一个术语,它是Quine。
I have come across a term, it is Quine.


"在计算中,quine是一个程序(元程序的一种形式),

产生完整的源代码作为唯一的输出。为了娱乐,

黑客有时会尝试用任何给定的编程语言开发最短的quine。
"In computing, a quine is a program (a form of metaprogram) that
produces its complete source code as its only output. For amusement,
hackers sometimes attempt to develop the shortest possible quine in
any given programming language."


任何人都可以解释一下它到底意味着什么?是否有某人用自己定义的某种语言的quine。
Can anyone explain me what does it exactly mean? And is there
someone''s self defined quine for some language.


这是显示它来源的程序:

main(a){a =" main(a){a =%c% S(%)C:printf的(A,34,,34);}英寸; printf(a,34,a,34);}

将显示

main(a){a =" main(a){a =%c%s %C; printf的(A,34,,34);}英寸; printf(a,34,a,34);}


It is program that show it''s source:

main(a){a="main(a){a=%c%s%c;printf(a,34,a,34);}"; printf(a,34,a,34);}

will display

main(a){a="main(a){a=%c%s%c;printf(a,34,a,34);}"; printf(a,34,a,34);}



这不一定有用,因为''\''''不一定是等于

34.

这可能不会起作用,因为printf还没有被声明并且

使用变量 - 长度参数列表。

This won''t necessarily work, because ''\"'' isn''t necessarily equal to
34.
This probably won''t work, because printf hasn''t been declared and it
uses a variable-length argument list.



[...]


它*可能*会起作用,因为许多编译器都使用了调用

约定允许可变参数函数在没有可见原型的情况下正常工作(历史原因可以追溯到发明原型之前的

天)。 />

注意强调单词可能。调用printf,或任何

可变参数函数,没有可见的原型调用undefined

行为,并且毫无疑问会实现它不会

工作。事实上,在这种特殊情况下,未定义的

行为的一个常见后果是,如果有原型,程序的行为就像它b / b那样。


-

Keith Thompson(The_Other_Keith) ks *** @ mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *< http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。

- Antony Jay和Jonathan Lynn,是部长

[...]

It *probably* will work, because many compilers use a calling
convention that allows variadic functions to work properly even
without a visible prototype (for historical reasons going back to the
days before prototypes were invented).

Note the emphasis on the word "probably". Calling printf, or any
variadic function, with no visible prototype invokes undefined
behavior, and there are undoubtedly implementations where it won''t
work. It just happens that a common consequence of the undefined
behavior in this particular case is that the program behaves as it
would if there were a prototype.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


这篇关于奎因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆