why bar and foo

R

Richard Heathfield

Hans Schneider said:

For example, the program from John J. Smith in the roman number thread.

It is > 100% unreadable!

When people ask comp.lang.c to do their homework for them, the result is
very often either unreadable or unprintable.
 
S

santosh

Hans said:
Ben said:
Hans Schneider said:
What purpose have variables and functions that have metasyntactic
purpose?

The point is to use them only when the meaning of the name would be a
distraction. In a perfect world every example would be a real one
with good meaningful variable names, but sometimes you just want to
show that you can't assign an array:

int foo[2], bar[2];
foo = bar; /* not allowed */

Yes, but what about using in real programs.
[ ... ]

Don't use them.
 
C

CBFalconer

Richard said:
Hans Schneider said:



When people ask comp.lang.c to do their homework for them, the
result is very often either unreadable or unprintable.

Or amazingly inefficient. Or amazingly efficient. :)
 
E

Eugene A. Pallat

This silly debate constantly makes the rounds. It's FUBAR.

The accronym stands for F****d Up Beyond All Recognition. It's been in use
since (at least) WW II.

Gene Pallat

Orion Data Systems
Orion Forensics
 
D

dj3vande

Ben Bacarisse said:
Ah. Your teacher means that foo and bar are bad in real programs. I
agree. I don't think I've ever seen either one in a real program.

I have a few times, but not frequently.

If you're writing something like
--------
{ char *foo=strchr(s,'\n'; if(foo) *foo='\0'; }
--------
then the name "foo" actually does carry some information; it says
"Coming up with a meaningful name for this variable is not worth the
effort, since it doesn't escape this line of code and it's obvious from
the context what it's for".
Calling the variable something like "nl" would perhaps be more
meaningful once you've figured out that "nl" is short for "newline",
but even that is extra effort above reading the line of code to
determine what it does. The shortest path to understanding the code
still doesn't involve getting information from the name of the
variable.
Calling it "newline_at_end_of_string_if_it_exists" would make it
blindingly obvious what the variable is for, but the cost to
readability is unacceptable.


dave
 
K

Keith Thompson

Eugene A. Pallat said:
This silly debate constantly makes the rounds. It's FUBAR.

The accronym stands for F****d Up Beyond All Recognition. It's been in use
since (at least) WW II.

Please don't top-post. See the following:
http://www.caliburn.nl/topposting.html
http://www.cpax.org.uk/prg/writings/topposting.php

The FUBAR acronym undoubtedly influenced the use of "foo" and "bar",
but there's ample evidence for other sources for "foo". See the
references that have already been posted in this thread.

In any case, this isn't about C. If you'd like to discuss it further,
try alt.folklore.computers (but please check their FAQ first).
Gene Pallat

Orion Data Systems
Orion Forensics

Your signature should be preceded by a line consisting of "-- ", so
newsreaders can recognize it.
 
A

ais523

Hans said:
Why use people here bar and foo so much?

I tried google, but I have only found what they are, not why they are used.

My teacher says bar and foo are bad words.

Why people use them?

So far nobody in this thread seems to have mentioned the relevant
standard RFC 3092 <http://tools.ietf.org/html/rfc3092>. It appears to
be a response to standardise the growing number of uses of 'foo' and
'bar', rather than to introduce the words in the first place, though;
the fact that it was dated April 1 also implies it might not be
entirely serious. However, it surprises me that the comp.lang.c
regulars weren't eager to point out about standards compliance as soon
as the thread started...
 
C

Charles Richmond

CBFalconer said:
Or amazingly inefficient. Or amazingly efficient. :)

The really amazing thing is that somebody thinks *you* should
do their work for them, for appropriate values of "you". If
a person does his/her own C homework, and do it well or badly,
*no* one in <c.l.c.> will complain. I promise. :)
 
R

Randy Howard

The really amazing thing is that somebody thinks *you* should
do their work for them, for appropriate values of "you".

I'm not amazed by that at all. I had people ask me to "help them"
(translation: "do their homework for them") 25 years ago.

What /does/ amaze me is the geeks that are desperate to flex their
epeens will actually do the homework for these people. Not all of them
mind you. However, if these Future Creators of Fabulously Broken
Software ask enough times, and phrase things just right, invariably one
or more of these pathetic little creatures will hammer out something
good enough to snow the professor into a passing grade.

They even pretend to believe it when the one asking for help says "oh,
it's not homework, it's just a hobby for me", despite the question
wording being obviously cut and pasted from a handout or class website.
The real concern is what happens down the road when every programmer
between the ages of 25 and 50 in the workforce is someone that went
through college getting all of their assignments done by some anonymous
geek. Once they get out there and realize all their little helpers are
dead, retired, or incapable of doing the real-work assignments for
them, what happens?
 
M

Martin Golding

The real concern is what happens down the road when every programmer
between the ages of 25 and 50 in the workforce is someone that went
through college getting all of their assignments done by some anonymous
geek. Once they get out there and realize all their little helpers are
dead, retired, or incapable of doing the real-work assignments for them,
what happens?

I'll tell you what happens. If the fresh crop is sufficiently useless,
HR departments are a little more likely to obey the age discrimination
laws when an crusty competent old programmer knocks on their door.


It is in my selfish self interest to see to it that the upcoming crop
of programmers, _especially_ the breeders of the future stock for the
Indian offshores which seem to be the source of most of the recent
particularly egregious examples of bad programming, produce the least
number of the least competent programmers.

As (except for pleasant daydreams) I don't hold my self-interest above
the general good, I have avoided being part of the problem. I don't
hesitate to indulge in a bit of schadenfreude when someone else fails
to do so.

Apres moi, of course, le deluge.

Martin
 
I

Ian Collins

Randy said:
The real concern is what happens down the road when every programmer
between the ages of 25 and 50 in the workforce is someone that went
through college getting all of their assignments done by some anonymous
geek. Once they get out there and realize all their little helpers are
dead, retired, or incapable of doing the real-work assignments for
them, what happens?
Us old and crusty contractors get a welcome boost to our retirement funds :)
 
R

Randy Howard

I'll tell you what happens. If the fresh crop is sufficiently useless,
HR departments are a little more likely to obey the age discrimination
laws when an crusty competent old programmer knocks on their door.

You moved the goalposts. :)

Note: "dead, retired, or incapable"
 
R

Richard Bos

Ian Collins said:
Us old and crusty contractors get a welcome boost to our retirement funds :)

I fear that you old and crusty contractors will just have to use the
broken software that results from McProgrammers with McEducations,
because even if the McSoftwarecompanies cared, they would neither want
nor, probably, be able to pay your old and gem-encrusted conslutancy
fees.

Richard
 
D

dj3vande

You moved the goalposts. :)

Note: "dead, retired, or incapable"

In that case, the young and crusty programmers (like me) will have
become the old and crusty programmers who get the job (and the
retirement fund boost).

Maybe I should start doing peoples' homework for them? I've been
restricting myself to ones where the combined b0rkenness of the
problem-as-stated and my solution is above a fairly high threshold.


dave
 
C

Charles Richmond

Randy said:
I'm not amazed by that at all. I had people ask me to "help them"
(translation: "do their homework for them") 25 years ago.

What /does/ amaze me is the geeks that are desperate to flex their
epeens will actually do the homework for these people. Not all of them
mind you. However, if these Future Creators of Fabulously Broken
Software ask enough times, and phrase things just right, invariably one
or more of these pathetic little creatures will hammer out something
good enough to snow the professor into a passing grade.

They even pretend to believe it when the one asking for help says "oh,
it's not homework, it's just a hobby for me", despite the question
wording being obviously cut and pasted from a handout or class website.
The real concern is what happens down the road when every programmer
between the ages of 25 and 50 in the workforce is someone that went
through college getting all of their assignments done by some anonymous
geek. Once they get out there and realize all their little helpers are
dead, retired, or incapable of doing the real-work assignments for
them, what happens?

When "all their little helpers are dead, retired, or incable of
doing the real-work asssignments for them", the little cretins
get laid off and their job is sent to China. But hey!!! That is
what will happen *anyway*. ;-) I *did* all my homework, and the
little squinty-eyed people *still* got my job...
 
D

David Thompson

Ah. Your teacher means that foo and bar are bad in real programs. I
agree. I don't think I've ever seen either one in a real program.
Borderline case: I've used them (and their friends) for temporary
debugging code in real programs. I wouldn't let anyone (probably
including you) see it until I finish debugging though.

<snip rest>
- formerly david.thompson1 || achar(64) || worldnet.att.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top