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

 
 
Keith Thompson
Guest
Posts: n/a
 
      09-14-2007
Friar Tuck <(E-Mail Removed)> writes:
> On 12 Sep 2007 at 23:47, pete wrote:

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

>
> Isn't the group website cpac.org? It's in one of the group moderator's
> signatures and has lots of C resources. It certainly looks official.


comp.lang.c has no moderator. Perhaps you're thinking of
comp.lang.c.moderate. In any case, cpac.org has nothing to do with C;
it's a political site.

[...]

> Was the final conclusion of this thread that Dr Sosman's function
> clashes with a common library funcion and should be renamed?

[...]

I don't think there was a conclusion. (One could also argue, though
less persuasively, that GNU's getline function should be renamed
because it conflicts with Eric's.)

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <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
 
 
 
 
Chris Dollin
Guest
Posts: n/a
 
      09-14-2007
Friar Tuck wrote:

> Isn't the group website cpac.org?


No.

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


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

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


What do you mean, "looks official"?

>>> > 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.

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


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

--
Chris "here be dragons" Dollin

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

 
Reply With Quote
 
 
 
 
Friar Tuck
Guest
Posts: n/a
 
      09-14-2007
On 14 Sep 2007 at 0:06, Barry Schwarz wrote:
> On Fri, 14 Sep 2007 01:39:12 +0200 (CEST), Friar Tuck
><(E-Mail Removed)> 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 <(E-Mail Removed)> 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? It's in one of the group moderator's
>>signatures and has lots of C resources. It certainly looks official.

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


OK, well senior member then.

>
> I wonder what you think a political web site has to do with the C
> language.


Whoops, yes, I seem to have remembered the address wrongly. I think it
was .org.uk instead.

>
>
> snip
>
>>
>>Actually, looking through that backtrace again is quite interesting:
>>
>>(gdb) p *file
>>$1 = {_flags = -72539008,
>> _IO_read_ptr = 0x40018000 'n' <repeats 25 times>, "\n", 'd' <repeats
>> 174 times>...,
>> _IO_read_end = 0x40018000 'n' <repeats 25 times>, "\n", 'd' <repeats
>> 174 times>...,
>> _IO_read_base = 0x40018000 'n' <repeats 25 times>, "\n", 'd'
>> <repeats 174 times>...,
>> _IO_write_base = 0x40018000 'n' <repeats 25 times>, "\n", 'd'
>> <repeats 174 times>...,
>> _IO_write_ptr = 0x40018000 'n' <repeats 25 times>, "\n", 'd'
>> <repeats 174 times>...,
>> _IO_write_end = 0x40018000 'n' <repeats 25 times>, "\n", 'd'
>> <repeats 174 times>...,
>> _IO_buf_base = 0x40018000 'n' <repeats 25 times>, "\n",
>> 'd' <repeats 174 times>...,
>> _IO_buf_end = 0x40019000 'b' <repeats 200 times>...,
>> _IO_save_base = 0x0,
>> _IO_backup_base = 0x0, _IO_save_end = 0x0, _markers
>> = 0x0,
>> _chain = 0x40151460,
>> _fileno = 6, _flags2 = 0, _old_offset = 0,
>> _cur_column = 0,
>> _vtable_offset = 0 '\0',
>> _shortbuf = "", _lock = 0x804a0a0, _offset =
>> 0, __pad1 =
>> 0x0, __pad2 = 0x804a0ac,
>> _mode = -1, _unused2 = '\0' <repeats
>> 51 times>}
>>(gdb)

>
> The internal structure of a FILE object is implementation dependent.
> You will need to ask in a group that discusses your implementation.


Are you sure? I'm fairly confident that the FILE * structure is a
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?

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

[Snipped]

Can I hear something under this bridge?
 
Reply With Quote
 
Friar Tuck
Guest
Posts: n/a
 
      09-14-2007
On 14 Sep 2007 at 7:41, Chris Dollin wrote:
> Friar Tuck wrote:
>
>> Isn't the group website cpac.org?

>
> No.


Sorry, .org.uk

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

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


Sorry, senior member.

>
>> 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.

>
>>>> > 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?

>
>> 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.

 
Reply With Quote
 
Joachim Schmitz
Guest
Posts: n/a
 
      09-14-2007
"Friar Tuck" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> On 14 Sep 2007 at 0:06, Barry Schwarz wrote:
>> On Fri, 14 Sep 2007 01:39:12 +0200 (CEST), Friar Tuck
>><(E-Mail Removed)> wrote:
>>

<snip>
>> The internal structure of a FILE object is implementation dependent.
>> You will need to ask in a group that discusses your implementation.

>
> Are you sure? I'm fairly confident that the FILE * structure is a
> 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: ...

Bye, Jojo


 
Reply With Quote
 
Joachim Schmitz
Guest
Posts: n/a
 
      09-14-2007
"Friar Tuck" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> On 14 Sep 2007 at 7:41, Chris Dollin wrote:
>> Friar Tuck wrote:

<snip>
>>
>>> 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.

So what? Of course fread would know (need to) about the (implementation
dependant) internals of FILE, but you don't need to know to be able to use
it.

Bye, Jojo


 
Reply With Quote
 
Richard Bos
Guest
Posts: n/a
 
      09-14-2007
"Joachim Schmitz" <(E-Mail Removed)> wrote:

> "Friar Tuck" <(E-Mail Removed)> 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.

Richard
 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      09-14-2007
Richard Bos said:

<snip>

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


Only if it's a union.

--
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
 
Chris Dollin
Guest
Posts: n/a
 
      09-14-2007
Friar Tuck wrote:

> On 14 Sep 2007 at 0:06, Barry Schwarz wrote:
>> On Fri, 14 Sep 2007 01:39:12 +0200 (CEST), Friar Tuck
>><(E-Mail Removed)> wrote:


>>>Isn't the group website cpac.org? It's in one of the group moderator's
>>>signatures and has lots of C resources. It certainly looks official.

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

>
> OK, well senior member then.


The word you're groping for is "regular". It has no official status.

>> The internal structure of a FILE object is implementation dependent.
>> You will need to ask in a group that discusses your implementation.

>
> Are you sure? I'm fairly confident that the FILE * structure is a
> fundamental type in standard C.


It isn't.

> Maybe there are some basic fields
> guaranteed to be present (which ones?) and others may be added as an
> extension?


No.

--
Chris "PLANE *" Dollin

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

 
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