foo是什么意思?

petershi 2002-08-31 11:36:47
foo是什么意思?为什么很多书举例子时都喜欢用foo做函数名,一定有典故吧?
...全文
1587 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
r00t 2010-06-20
  • 打赏
  • 举报
回复

Just as economists sometimes use the term "widget" as the ultimate substitute for "something" that is being measured, programmers tend to use the term "foo" (pronounced FOO) as a universal substitute for something real when discussing ideas or presenting examples. Suppose you are defining a template for any group of programmers to follow when creating a new user command, you might specify that the syntax for the command should be in the form:
Command foo (arg1, arg2)

where the "foo" would mean "the name you give to this command." In other words, "foo" is a nonsense kind of placeholder for some value that will be provided when using this template to define a real command. (And the "arg1" and "arg2" are arguments or information you would define that would be passed along with the command.) Because "foo" has no rational meaning of its own and because "foo" is conventionally used as such a placeholder, the idea will be clear to any programmer.
Foo or any such word used this way is formally known as a metasyntactic variable. Eric Raymond, probably the world's greatest authority on foo and other metasyntactic variables, also lists qux, waldo, fred, xyzzy, and thud among others that are occasionally used. Although foo is the canonical metasyntactic variable, Raymond notes that cultures outside the United States have their own preferences. Fred, barney, and wombat seem common in the U.K. Toto, tata, titi, and tutu reportedly are used by the French. Blarg and wibble are used in New Zealand.

The origin of foo seems wrapped in the mists of time, but Raymond observes (and we remember) that in Bill Holman's comic strip of the 1930-50 era, Smokey Stover, the letters "FOO" commonly appeared, unexplained and as a kind of running gag, on license plates, in picture frames, and on the backs of sandwich board signs.

Also see FUBAR.


CONTRIBUTORS: Kevin Barrett and R. Terry McCutchen
LAST UPDATED: 14 Dec 2006
无来 2002-08-31
  • 打赏
  • 举报
回复
呵呵!!!!!!!!!!!!!!!!!学习ing
leasun 2002-08-31
  • 打赏
  • 举报
回复
foo是个语气词,没什么特别的意思
snwcwt 2002-08-31
  • 打赏
  • 举报
回复
9494,谁说一下啊?
JJZHK 2002-08-31
  • 打赏
  • 举报
回复
这个问题有意思
alexxing 2002-08-31
  • 打赏
  • 举报
回复
The quick brown fox jumps over the lazy dog!

haha :)
EthanJiang0827 2002-08-31
  • 打赏
  • 举报
回复
foo:
1:interj.Term of disgust
2:[very common]used very generally as a sample name for absolutely anything,esp.programs and files(esp.scratch file).
3:first ofn the standard list of metasyntactic variables used in syntax examples.See also bar,baz,qux,quux,corge,grault,garply,waldo,fred,plugh,xyzzy,thud

巴比伦上面写了很多,主要是这三点,其他的都是解释,看不懂了啊!不过看来好像真的没有什么意义,是一个很普通的东西啊,用的人多了,也就成了约定俗成的了!:)

好玩
tqhfenbid 2002-08-31
  • 打赏
  • 举报
回复
函数名随便随便!
topikachu 2002-08-31
  • 打赏
  • 举报
回复
http://www.china-pub.com/computers/eMook/emooknew/rfctxt/RFC3092.txt
哈,我还找到了中文翻译
LLnju 2002-08-31
  • 打赏
  • 举报
回复
foo: 一塌糊涂 , 就是没有什么意思
qhd0233 2002-08-31
  • 打赏
  • 举报
回复
LifeAndC(紫唇泪) :
看样子你应该是看了那本《编程黑马真言》了,那本书上有很详细的解释啊,难到你没看到?就在书的最后面。
pleasehelpme 2002-08-31
  • 打赏
  • 举报
回复
fun,up!
topikachu 2002-08-31
  • 打赏
  • 举报
回复
有foo肯定还有bar
http://www.ietf.org/rfc/rfc3092.txt
很好玩的来历:),好像还和中文有关系
sunshine1217 2002-08-31
  • 打赏
  • 举报
回复
有意思!!
yixudong 2002-08-31
  • 打赏
  • 举报
回复
我认为作为函数名就是代表“没有什么特殊”意义的意思。

仅仅是作为名字而已。
Alick1 2002-08-31
  • 打赏
  • 举报
回复
估计写文档时,此“foo”就是赋值的“赋”!
echoher 2002-08-31
  • 打赏
  • 举报
回复
或许是讲给foolish的
moonese 2002-08-31
  • 打赏
  • 举报
回复
问的好,有游游于艺的味道。
不过我也不知道。

food
来自古英语foda
[fu:d]
n
食物,食品
without food and drink
没有食物和饮料
可食之物
精神食粮;材料;资料

nutriment

fop
[ fCp ]
n.过分讲究衣饰或举动的人, 花花公子
我的女神 2002-08-31
  • 打赏
  • 举报
回复
王轶男<<编程黑马真言>>中常有这个foo,我也不知道是什么意思!
netbian 2002-08-31
  • 打赏
  • 举报
回复
我也不知道
:)
加载更多回复(1)

69,378

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧