天天看點

foo是個什麼東東

很多教程式的書裡,都有采用foo命名的變量、函數,那麼foo究竟是個什麼東西呢?

從網絡上可以查考到它的英文解釋:

***********************************************************************************

foo   /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   files).   

  3.   First   on   the   standard

  list   of   metasyntactic   variables   used   in   syntax  

examples.   See   also   bar,   baz,   qux,   quux,   corge,   grault,

  garply,   waldo,   fred,   plugh,   xyzzy,   thud.

請大家注意第2個解釋:

[極為常用]在程式或檔案中指代任何一個東西。

其實它的意思就是,如果你想不出一個名字,就随便寫個foo。類似于我國的“路人甲”,“張三”。

在C語言中,相當于:int a,b;沒有什麼實質意思,随手指代而已。

繼續閱讀