1 前言
在很多國外電腦書本和一些第三份開源軟體的Demo中經常用到兩個英文單詞Foo,Bar。這到底是什麼意思呢?從步入屌絲界的IT生活簡單這兩個單詞到現在我還是不知道這兩個單詞的真正含義,今天有必要查查總結下。
2 維基百科上的解釋
原文:
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.
譯文:
術語foobar, foo, bar, baz 和qux經常在電腦編程或電腦相關的文檔中被用作預留位置的名字。當變數,函數,或命令本身不太重要的時候,foobar, foo,bar, baz 和qux就被用來充當這些實體的名字,這樣做的目的僅僅是闡述一個概念,說明一個想法。這些術語本身相對於使用的情境來說沒有任何意義。Foobar經常被單獨使用;而當需要多個實體舉例的時候,foo,bar,和baz則經常被按順序使用。
本欄目更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/Programming/project/
3 百度百科上的解釋
bar是beyond all recognition的縮寫,通俗點就是無法識別,一塌糊塗的意思
foo是fu的變體,fu是英語習語fuck-up的縮寫,同樣是一團糟的意思
百度百科地址foobar的解釋地址
http://baike.baidu.com/link?url=HtHnyAqLEsM9cV0dCPalfFE5jI6GCV-H3xXbaulU6nhW7ccfKQy756KSn1z6OV0UW3Dz_KNSHim0u0ENS8RVZq
4 符合國情的更加通俗的解釋
編程裡面的foo和bar就是我們小時候寫作文裡面的小明和小紅。寫作文的時候,當然情節最重要,花時間去想角色的名字太麻煩了,就乾脆叫小明小紅好了。
cnblogs 天魂地煞