Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Bug in SosMan's getline_test

Reply
Thread Tools

Bug in SosMan's getline_test

 
 
Chris Dollin
Guest
Posts: n/a
 
      09-14-2007
Friar Tuck wrote:

> On 14 Sep 2007 at 7:41, Chris Dollin wrote:


>> What do you mean, "looks official"?

>
> It has this resources page
> http://cpax.org.uk/prg/portable/c/resources.php that gives the
> impression it's the official resources page for comp.lang.c though maybe
> that's just what comes across from the first paragraph.


I get no such impression.

>>>>> > GNU lib'c getline
>>>>
>>>>> I don't believe there's a standard library function called getline.
>>>>
>>>> There isn't.
>>>> What is your native language?
>>>
>>> C (gcc 4.1.3).

>>
>> I think they meant your native /spoken/ language.

>
> What in any of my posts suggests that my native spoken language isn't
> English?? Why is it relevant?


Don't ask me; ask the person who asked the question. Probably they
thought that what you said suggested you hadn't understood them in
a way that suggests ESL.

>>> Does anyone know what all these fields in the FILE * structure do?

>>
>> Something implementation-dependant. Portable code can't care about it.

>
> I believe you are mistaken - portable functions like fread etc. take a
> FILE * structure for an argument.


`fread` isn't portable; it is specific to each implementation. That's
why it's there in the Standard; you can't portably write one yourself.
(Well, you can -- but it's useless.)

--
Chris "return 0;" Dollin

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN

 
Reply With Quote
 
 
 
 
Chris Dollin
Guest
Posts: n/a
 
      09-14-2007
Mark Bluemel wrote:

> Friar Tuck wrote:
>
> [Snipped]
>
> Can I hear something under this bridge?


Insufficient data. Yet.

--
Chris "waiting" Dollin

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England

 
Reply With Quote
 
 
 
 
Mark Bluemel
Guest
Posts: n/a
 
      09-14-2007
Friar Tuck wrote:
> On 14 Sep 2007 at 0:06, Barry Schwarz wrote:


>> This group doesn't have a moderator either.

>
> OK, well senior member then.


As in "senior moment"?
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      09-14-2007
Friar Tuck <> writes:
> On 14 Sep 2007 at 7:41, Chris Dollin wrote:
>> Friar Tuck wrote:
>>
>>> Isn't the group website cpac.org?

>>
>> No.

>
> Sorry, .org.uk


You're thinking of cpax.org.uk, but that site has absolutely no
official standing with respect to this newsgroup.

>>
>>> It's in one of the group moderator's

>>
>> comp.lang.c doesn't have a moderator.

>
> Sorry, senior member.


Richard Heathfield is a regular participant in this newsgroup. So am
I. So are a number of others. Since this is an unmoderated
newsgroup, nobody has any official status, because there is no
official status to be had.

>>> signatures and has lots of C resources. It certainly looks official.

>>
>> What do you mean, "looks official"?

>
> It has this resources page
> http://cpax.org.uk/prg/portable/c/resources.php that gives the
> impression it's the official resources page for comp.lang.c though maybe
> that's just what comes across from the first paragraph.


I'm sure that Richard did not intend to give that impression.

The FAQ site, <http://www.c-faq.com/>, is the closest thing we have to
an "offical" site for the newsgroup, but even it has no real official
standing. I could set up my own FAQ site tomorrow. I don't because
(a) it would be a lot of work, and (b) Steve Summit has already done
such a fine job of it.

>>>>> > GNU lib'c getline
>>>>
>>>>> I don't believe there's a standard library function called getline.
>>>>
>>>> There isn't.
>>>> What is your native language?
>>>
>>> C (gcc 4.1.3).

>>
>> I think they meant your native /spoken/ language.

>
> What in any of my posts suggests that my native spoken language isn't
> English?? Why is it relevant?


The question was, I believe, intended to point out that you had
misunderstood something that should have been reasonably clear.
Somebody mentioned the 'getline' function that's part of the GNU
library. You responded by saying that there's no such standard
library function -- but nobody had said that there was. The 'getline'
function in question is specific the GNU library (glibc), and the
person who mentined it said so explicitly.

Making this point by questioning whether English is your native
language was perhaps a bit rude. But I'll mention that there are
plenty of people with other native languages who write excellent
English, better than some native speakers. Such people sometimes make
surprising errors.

>>> Does anyone know what all these fields in the FILE * structure do?

>>
>> Something implementation-dependant. Portable code can't care about it.

>
> I believe you are mistaken - portable functions like fread etc. take a
> FILE * structure for an argument.


No, he's not mistaken. That's why the fread function cannot be
implemented in portable code. Each (hosted) implementation must
provide the function, so code that uses it can be portable, but the
function itself can and must use implementation-specific techniques
(unless it's implemented entirely in terms of other standard
functions).

--
Keith Thompson (The_Other_Keith) kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      09-14-2007
Keith Thompson said:
> Friar Tuck <> writes:
>> On 14 Sep 2007 at 7:41, Chris Dollin wrote:
>>> Friar Tuck wrote:


<snip>

>>>> signatures and has lots of C resources. It certainly looks
>>>> official.
>>>
>>> What do you mean, "looks official"?

>>
>> It has this resources page
>> http://cpax.org.uk/prg/portable/c/resources.php that gives the
>> impression it's the official resources page for comp.lang.c though
>> maybe that's just what comes across from the first paragraph.

>
> I'm sure that Richard did not intend to give that impression.


Actually, I'd /love/ to give the impression that my site is "official"
in some way, because that would indicate that my Web skills are just as
amazing as all my other skills - but apathy always wins out.

From the sidelines, I've been watching this discussion with some
amusement, and I saw no particular need to interfere (that cpac
political thing was a real eye-opener, btw!), but a word in season
seems to be indicated here, so here we go:

Anyone who looks at my Web site and genuinely thinks it to be the
official comp.lang.c Web site has got to be off his rocker. Completely
out to lunch. A brick, two windows, several roofing slates, two
teenagers, a loft hatch, and twenty square feet of dry rot short of a
house.

Message ends.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
 
Reply With Quote
 
Barry Schwarz
Guest
Posts: n/a
 
      09-14-2007
On Fri, 14 Sep 2007 11:24:56 GMT, (Richard
Bos) wrote:

>"Joachim Schmitz" <> wrote:
>
>> "Friar Tuck" <> schrieb im Newsbeitrag
>> > Are you sure? I'm fairly confident that the FILE * structure is a

>
>There's no such thing as a "FILE * structure". There's a FILE, which is
>an object type, not necessarily a struct, and a FILE *, which is a
>pointer to that type.
>
>> > fundamental type in standard C. Maybe there are some basic fields
>> > guaranteed to be present (which ones?) and others may be added as an
>> > extension?

>
>> from n1256, 7.19.1 p2:
>> The types declared are ...; FILE which is an object type capable of
>> recording all the information needed to control a stream, including its file
>> position indicator, a pointer to its associated buffer (if any), an error
>> indicator that records whether a read/write error has occurred, and an
>> end-of-file indicator that records whether the end of the file has been
>> reached: ...

>
>And note that there is no indication whatsoever _how_ a FILE records
>this information. It could be a struct; it could also be an array of
>unsigned chars.


And in a reply with insufficient quoting

On Fri, 14 Sep 2007 11:48:08 +0000, Richard Heathfield
<> wrote:

Discussing the internal nature of a FILE object

>Richard Bos said:
>
><snip>
>
>> It could be a struct; it could also be an array of
>> unsigned chars.

>
>Only if it's a union.


Care to expand?

Do you infer that the file position information must be stored in a
long, the pointer information in a pointer object, etc? It is
certainly possible for an array of unsigned char to contain this data
without any other type of object.

By the way, since the buffer need not be a defined C object, what type
of pointer do you think would be appropriate?


Remove del for email
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      09-14-2007
Barry Schwarz <> writes:
> On Fri, 14 Sep 2007 11:24:56 GMT, (Richard
> Bos) wrote:
>>"Joachim Schmitz" <> wrote:

[...]
>>> It could be a struct; it could also be an array of
>>> unsigned chars.

>>
>>Only if it's a union.

>
> Care to expand?


O n l y i f i t ' s a u n i o n . : - )

I believe RH was making one of his little jokes. Note:

It could be a struct; it could *also* be an array of unsigned
chars.

The only way it could be *both* is if it's a union.

Actually, that's not *strictly* correct (a union containing a struct
is not a struct), but it's close enough for humorous purposes.

--
Keith Thompson (The_Other_Keith) kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
pete
Guest
Posts: n/a
 
      09-14-2007
Friar Tuck wrote:
>
> On 12 Sep 2007 at 23:47, pete wrote:
> > Friar Tuck wrote:
> >>
> >> On 11 Sep 2007 at 23:30, Ben Pfaff wrote:
> >> > Friar Tuck <> writes:
> >> >
> >> >> I believe I have found a bug in
> >> >> Dr Sosman's getline_test program,

> >
> > Is he really a doctor?
> >
> >> >> which is one of the official newsgroup programs.
> >> >
> >> > There is no such thing as an "official newsgroup program", at
> >> > least not in comp.lang.c
> >>
> >> Well, it's listed on the group website, so I'd say that's official.

> >
> > There is no such thing as "the group website".

>
> Isn't the group website cpac.org?


No.

> It's in one of the group moderator's


There is no group moderator.

You're coming across as being delusional.

--
pete
 
Reply With Quote
 
pete
Guest
Posts: n/a
 
      09-14-2007
Keith Thompson wrote:
>
> Friar Tuck <> writes:


> > What in any of my posts suggests
> > that my native spoken language isn't
> > English?? Why is it relevant?

>
> The question was, I believe, intended to point out that you had
> misunderstood something that should have been reasonably clear.
> Somebody mentioned the 'getline' function that's part of the GNU
> library. You responded by saying that there's no such standard
> library function -- but nobody had said that there was. The 'getline'
> function in question is specific the GNU library (glibc), and the
> person who mentined it said so explicitly.
>
> Making this point by questioning whether English is your native
> language was perhaps a bit rude.


Yes, it was.

Most of OP's writings seem to consist of bizarre assumptions,
stated as facts.

OP's camel case spelling of "SosMan" in the subject line
is an unusual affectation, which makes me wonder
if the doctorate in "Dr Sosman" is also a delusion.

--
pete
 
Reply With Quote
 
Eric Sosman
Guest
Posts: n/a
 
      09-16-2007
Friar Tuck wrote:
> 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.

--
Eric Sosman
lid
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
ASP.NET Login control bug or SQL 2005 bug? RedEye ASP .Net 2 12-13-2005 10:57 AM
Re: BUG? OR NOT A BUG? John ASP .Net 2 09-21-2005 10:31 AM
Bug Parade Bug 4953793 Michel Joly de Lotbiniere Java 4 12-02-2003 05:05 AM
how to report bug to g++ ? got a bug and fixed up source code DarkSpy C++ 4 06-27-2003 09:05 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57