且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么foo和bar在我阅读的每个教程中?

更新时间:2023-11-20 20:06:40

ravi4udude写道:
为什么这些用作变量名?任何故事?




阅读本文:

http://www.catb.org/~esr/jargon/html/F/foo.html


" ravi4udude" < RA *************** @ gmail.com>在消息中写道

新闻:11 ********************* @ z14g2000cwz.googlegro ups.com ...
为什么这些用作变量名?任何故事?




他们来自FUBAR,这是美国海军的一个旧缩写词Fucked

up over all repair。在麻省理工学院至少有半个世纪的时间里,这个词有相当多的货币,即AFAIK。嘟嘟

黑客是我认识的第一批蒸馏出来的人。

foo和bar作为通用标识符。


HTH,


PJ Plauger

Dinkumware,Ltd。
http://www.dinkumware.com


ravi4udude说:
为什么这些用作变量名?任何故事?




Google forJargon File,或浏览 http://www.catb.org/~esr/jargon/ 如果我

记得正确。


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上面的域名(但显然放弃了www)


Why these used as variable name? any story?

ravi4udude wrote:
Why these used as variable name? any story?



Read this:

http://www.catb.org/~esr/jargon/html/F/foo.html


"ravi4udude" <ra***************@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Why these used as variable name? any story?



They derive from FUBAR, an old US Navy acronym for "Fucked
up beyond all repair." The term had considerable currency
at MIT going back at least half a century, AFAIK. Toot
hackers were the first people I knew of who distilled out
foo and bar as generic identifiers.

HTH,

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com


ravi4udude said:
Why these used as variable name? any story?



Google for "Jargon File", or browse http://www.catb.org/~esr/jargon/ if I
remembered that correctly.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)