有些朋友問:foo , bar 是什麼意思,為什麼C++書籍中經常見到這個詞。
我google了一下, 發現沒有很好的中文答案。這個問題,在維基百科上有很好的回答。在這裡翻譯給大家。
譯文:
術語,
foobar
,
foo
,
bar
和
baz
經常在計算機程式設計或計算機相關的文檔中被用作占位符的名字。當變量,函數,或指令本身不太重要的時候,
qux
,
foobar
,
foo
,
bar
和
baz
qux
就被用來充當這些實體的名字,這樣做的目的僅僅是闡述一個概念,說明一個想法。
這些術語本身相對于使用的場景來說沒有任何意義。
經常被單獨使用;而當需要多個實體舉例的時候,
foobar
,
foo
,和
bar
則經常被按順序使用。
baz
原文:
The terms foobar, foo, bar, baz and qux are sometimes used as placeholder names (also referred to as metasyntactic variables) in computer programming or computer-related documentation.[1] They have been used to name entities such as variables, functions, and commands whose purpose is unimportant and serve only to demonstrate a concept. The words themselves have no meaning in this usage. Foobar is sometimes used alone; foo, bar, and baz are sometimes used in that order, when multiple entities are needed.
參考資料:
Foo, Bar是什麼意思? - 中道學友
Foobar - Wiki