Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

is this some kind of obsession with foo()?

session

  • Please log in to reply
2 replies to this topic

#1 jackson6612

jackson6612

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 285 posts

Posted 26 May 2011 - 10:34 PM

Hi

I have seen many people mentioning the function foo(). What is that foo()? Why do they mention it so often in examples? Is this just some kind of obsession?!:)
  • 0
I'm an outright beginner, learning C++. Using Win XP Pro and Code::Blocks. Be nice to me, please.:)

#2 Alexander

Alexander

    YOL9

  • Moderator
  • 3963 posts
  • Location:Vancouver, Eh! Cleverness: 200
  • Programming Language:C, C++, PHP, Assembly

Posted 27 May 2011 - 01:26 AM

It is just one of those slang words, with no cement origin. Programmers often use the words foo, bar, qux, baz on their own or in combination as placeholders for names, or variables.

There is funny enough an RFC (request for comments, of internet engineering task force) page on the etymology of foo and bar: RFC 3092 - Etymology of "Foo" (RFC3092)

It is often easier to write foobar than "anumber" or "somefunc" especially when the name of the function does not matter (you only wish to explain the code in the function not the function name) although it has different meaning to people.
  • 0

All new problems require investigation, and so if errors are problems, try to learn as much as you can and report back.


#3 DarkLordCthulhu

DarkLordCthulhu

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 422 posts
  • Location:The bash shell
  • Programming Language:C, JavaScript, Bash, Others
  • Learning:Ruby, Others

Posted 27 May 2011 - 03:40 AM

The New Hacker's Dictionary - = F =
  • 0
Programming is a journey, not a destination.





Also tagged with one or more of these keywords: session

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download