What does foo mean

UFO

Active member
I see it sometimes in code examples where they use the name "foo" as a temporary variable or a useless function for example. Mostly the code is derived from the UNIX world. What does this "foo" mean?
 
Hmm. . .
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.
 
Thanks Ostsol, I guess it doesn't mean anything. Perhaps the programmers used the word foo instead of s**t for example when they didn't know what to name functions and variables as it was less offending.
 
LOL! Well, there's always "stuff" and "dostuff". . . There's was someone in a C++ class I took who actually handed in labs with variables and functions named like that. . .
 
Hi,

I heard this interesting story from a well respected professor in computer science who has been around since 1970s. He mentoined that in the early days of computer languages and programming (1960s), often programmers/computer scientists/professors wrote such cumbersome and hard to understand programs that many of the variables and programmed were termed

f**ked up beyond any recognization

This was shortened into fubar. Due to phonetics reason, this was often later rewrote as foobar (as fubar sounds more like it). This was latern split into foo and bar, which both became common names for temp variables, things with no useful or transient existence etc.

Both foo and bar continue to be used as temp, useless names - foo with much higher frequency.

Whether the story is true or not is anybody's guess :).

cheers,
Osho
 
My programing teacher told me this:

They used it as variable names when they are just giving an example programming situation. They use 'foo', then 'bar', then 'foobar'.
 
I concur with osho_gg. That's what I've been told too. I think some examples are starting using foobaz instead of foobar though.
 
Back
Top