有些朋友問: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.