![]() |
| | #1 |
| Registered User Join Date: Aug 2005
Posts: 37
| anyone here hate when foo bar baz is used in example code? |
| shintaro is offline | |
| | #2 | |
| Gawking at stupidity Join Date: Jul 2004
Posts: 2,324
| Quote:
foo = variable foo(<args>) = function "foo" = string
__________________ If you understand what you're doing, you're not learning anything. Ignore any "advice" esbo tries to give you. It's wrong. | |
| itsme86 is offline | |
| | #3 | |
| Registered User Join Date: Aug 2005
Posts: 37
| Quote:
Try this example, I was currently reading this in the article "Understanding Initialization Lists in C++" which is on this site: Code: int main()
{
// a lovely elephant ;)
Bar bar;
}
| |
| shintaro is offline | |
| | #4 |
| Registered User Join Date: Oct 2004
Posts: 151
| http://www.catb.org/jargon/html/M/me...-variable.html Bar bar is just the author being stupid and making a lame pun on "Babar".
__________________ System: Debian Sid and FreeBSD 7.0. Both with GCC 4.3. Useful resources: comp.lang.c FAQ | C++ FQA Lite |
| zx-1 is offline | |
| | #5 | |
| Registered User Join Date: Jul 2003
Posts: 1,088
| Quote:
| |
| jlou is offline | |
| | #6 |
| Gawking at stupidity Join Date: Jul 2004
Posts: 2,324
| Or a struct and an instance of a struct ![]() Either way. It's obviously a declaration in the normal form <type> <name>; and changing Bar to something else still wouldn't tell you if it was a class or a struct.
__________________ If you understand what you're doing, you're not learning anything. Ignore any "advice" esbo tries to give you. It's wrong. |
| itsme86 is offline | |
| | #7 |
| Registered User Join Date: Aug 2005
Posts: 37
| Which of these is more readable? this: Code: Void modifyName(char name[100])
{
strcat (name, “ is stupid”);
}
void setUpName(void)
{
char name[100];
sprintf(name, “Jake”);
modifyName(name);
printf(“%s”, name);
}
Code: Void foo(char baz[100])
{
strcat (baz, “ quz”);
}
void bar(void)
{
char baz[100];
sprintf(baz, “qok”);
foo(baz);
printf(“%s”, baz);
}
Last edited by shintaro; 09-25-2006 at 05:54 PM. |
| shintaro is offline | |
| | #8 |
| Gawking at stupidity Join Date: Jul 2004
Posts: 2,324
| They're both wrong.
__________________ If you understand what you're doing, you're not learning anything. Ignore any "advice" esbo tries to give you. It's wrong. |
| itsme86 is offline | |
| | #9 |
| (?<!re)tired Join Date: May 2006 Location: Portugal
Posts: 5,661
| Some people exaggerate their use. foo, bar and baz should be used as placeholders. Nothing more. Their only purpose is to exemplify or demonstrate some concept. Not to be used as actual names. For instance, if I'm talking about the relation between two classes, I may want to exemplify with a code where each class is named foo and bar. The name of the classes is meaningless for the argument at hand. foo and bar served only as placeholder names to give meaning to the code.
__________________ Originally Posted by brewbuck: Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster. |
| Mario F. is online now | |
| | #10 |
| Registered User Join Date: Aug 2006
Posts: 159
| what bothers me the most is that it should actually be fu and bar, not foo and bar. Seeing as how fubar stands for F***ed Up Beyond All Repair. |
| System_159 is offline | |
| | #11 |
| Sweet Join Date: Aug 2002 Location: Tucson, Arizona
Posts: 1,698
| I prefer to name my example classes and such poop and pee.
__________________ Woop? |
| prog-bman is offline | |
| | #12 |
| Gas pump powered Join Date: Oct 2001
Posts: 853
| I like egg and spam...
__________________ Yoshi |
| Yoshi is offline | |
| | #13 |
| Super Moderator Join Date: Aug 2001
Posts: 7,817
| I like green eggs and ham. |
| Bubba is offline | |
| | #14 |
| and the hat of Jobseeking Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,706
| > But how are you supposed to remember what foo does? Because they're never supposed to be used in real code, only examples of concept or syntax. When you understand that, simply replace them with whatever is actually meaningful in your code. Side effect - it stops people from simply copy/pasting the answers and actually doing a bit of work. |
| Salem is offline | |
| | #15 | |
| Reverse Engineer Join Date: Aug 2005 Location: Estonia
Posts: 2,260
| Quote:
__________________ The duck is irrelevant to my point. | |
| maxorator is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Values changing without reason? | subtled | C Programming | 2 | 04-19-2007 10:20 AM |
| Explain this C code in english | soadlink | C Programming | 16 | 08-31-2006 12:48 AM |
| beach bar (sims type game) | DrKillPatient | Game Programming | 1 | 03-06-2006 01:32 PM |
| Who will map the scan code (inserted by VKD_Force_keys) to virtual key code? | Unregistered | Windows Programming | 0 | 02-21-2002 06:05 PM |
| Can you have nested code block? What does the compiler do? For example ... | albertr | C Programming | 4 | 01-16-2002 12:04 AM |