Friar said:
I believe I have found a bug in Dr Sosman's getline_test program, which
is one of the official newsgroup programs. [...]
Just back from a week without Usenet access, let me
try to clear up a few points that have appeared in this
thread. In no particular order:
- Tuck's problem stems from running my getline_test program
with somebody else's getline() function. There is no official
specification for what a getline() function should behave nor
for how a program should call it, so my program's failure when
used with an unexpected getline() does not demonstrate that my
program is buggy. Try to write a foo_test program to exercise
every function called foo() ever posted to this newsgroup, and
you'll understand the problem.
- Name collisions are a fact of life in C programs made up
of bits and pieces from multiple, uncoordinated sources. The
language (like many others) provides little to help an integrator
avoid the problem or deal with it when it arises. The Standard
helps only a little, by dividing the universe of names into three
parts like a digital Caesar: Names that can only be used as the
Standard dictates, names that can only be used by implementations,
and names that can only be used by programmers. Writers of utility
functions don't fit comfortably into any of these three classes,
and inevitably bump into each other.
- My decision to use the name getline() has been criticized
as "a poor one." As outlined above, no name choice is 100% safe;
it is not possible to anticipate all the names all the other
programmers in the world might choose to use. That's one of the
reasons source is provided: you can edit it and override my decision
if you think it poor. I suggest the critic should change the name
to getstuffed().
- The whole digression about puts() vs. printf() vs. who
can spot the missing newline while writing his name in the snow
is a sad reflection on c.l.c. and the people who make it up.
Sadder still, it is not the first such asinine sub-thread.
- If there is an official c.l.c. web site I have never heard
of it. (One wonders what office's proclamation could bestow
"official" status on a web site, anyhow. If someone suddenly
pops up and announces that
http://127.0.0.1/ is now the official
web site of alt.swedish.chef.bork.bork.bork, my first reaction
is to wonder who died and made him Emperor.) In any case, there
is nothing at all "official" about my code, wherever hosted.
- Speaking of code: I hope you will use different standards
when judging my getline() and my getline_test. The former is an
attempt to write something small and simple, with reasonable
portability and an emphasis on ease of use. The latter is a
unit test that tries to exercise the function and verify that
it has worked properly; ease of use is not very important, and
neither is smallness or simplicity. In this case, portability
is compromised, too (it tries to test a circumstance that may
not be possible to produce on all systems, so some sacrifice of
portability is required in any event).
- My father was a doctor, and his father was a doctor, and
several of my friends and acquaintances are doctors, but I am
not even a fud.