Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #66454

Re: Fgets question

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Fgets question
Date 2015-07-27 11:42 -0700
Organization None to speak of
Message-ID <lnzj2ho31i.fsf@kst-u.example.com> (permalink)
References (6 earlier) <kfntwsylnr6.fsf@x-alumni2.alumni.caltech.edu> <lnfv4ifvzj.fsf@kst-u.example.com> <kfnio99h465.fsf@x-alumni2.alumni.caltech.edu> <ln6159z7s2.fsf@kst-u.example.com> <kfnpp3eebbi.fsf@x-alumni2.alumni.caltech.edu>

Show all headers | View raw


Tim Rentsch <txr@alumni.caltech.edu> writes:
> Keith Thompson <kst-u@mib.org> writes:
>> Tim Rentsch <txr@alumni.caltech.edu> writes:
>>> Keith Thompson <kst-u@mib.org> writes:
>> [snipping most as being mostly a repeat]
>>
>>>> The bottom line is that I disagree with your assertion that the
>>>> standard might define the behavior for text streams.  By my
>>>> reading, it simply doesn't.
>>>
>>> Yes, by your reading.  Isn't it possible that other readings
>>> might define it?
>>
>> Not as far as I can see.
>
> It surprises me that you think something definitive can be
> said about all possible readings, especially since you
> agree that some of the pertinent language is rather oddly
> worded (my paraphrase, I don't mean to put words in your
> mouth).  However at this point I don't think there is any
> more to say except that we have different opinions on the
> question of whether some ways of reading the Standard may
> define or partially define the semantics in such cases.

I wrote "Not as far as I can see."  That's a definitive statement about
what I'm able to see in the standard, not about the standard itself.
My statement about the standard itself, that it doesn't define the
behavior in the absence of a terminating new-line, is not quite as
definitive.

    A text stream is an ordered sequence of characters composed into
    lines, each line consisting of zero or more characters plus a
    terminating new-line character. Whether the last line requires
    a terminating new-line character is implementation-defined.

One possible interpretation is, as you suggest, that any characters
following the last new-line in a text stream are ignored.  Another is
that an implicit new-line is added to the end of the stream (the
stream "requires" a terminating new-line, so the implementation
gives it one).  Yet another is that the stream is ill-formed,
and any attempt to read it, or to read to the end of it, can fail
with an I/O error.

I see nothing in the standard that suggests any of those alternatives
over the others.  I therefore conclude (tentatively) that the standard
does not define the behavior, which is precisely equivalent to saying
that the behavior is undefined.

If the committee published a response to a defect report specifying some
particular behavior, I would accept it.  In the absence of any such
statement, I can only go by the wording in the standard itself.

Do you see something that I'm missing?

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Fgets question Paul N <gw7rib@aol.com> - 2015-07-06 14:06 -0700
  Re: Fgets question Barry Schwarz <schwarzb@dqel.com> - 2015-07-06 15:09 -0700
    Re: Fgets question Keith Thompson <kst-u@mib.org> - 2015-07-06 16:41 -0700
      Re: Fgets question Paul N <gw7rib@aol.com> - 2015-07-07 15:16 -0700
  Re: Fgets question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-06 23:13 +0100
    Re: Fgets question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-07 00:57 +0100
  Re: Fgets question Keith Thompson <kst-u@mib.org> - 2015-07-06 16:29 -0700
    Re: Fgets question Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-11 05:16 -0700
      Re: Fgets question Keith Thompson <kst-u@mib.org> - 2015-07-11 14:04 -0700
        Re: Fgets question Richard Damon <Richard@Damon-Family.org> - 2015-07-11 19:56 -0400
        Re: Fgets question Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-15 09:26 -0700
          Re: Fgets question Keith Thompson <kst-u@mib.org> - 2015-07-15 10:42 -0700
            Re: Fgets question Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-20 10:53 -0700
              Re: Fgets question Keith Thompson <kst-u@mib.org> - 2015-07-20 12:51 -0700
                Re: Fgets question Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-24 10:10 -0700
                Re: Fgets question Keith Thompson <kst-u@mib.org> - 2015-07-24 12:15 -0700
                Re: Fgets question Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-26 16:41 -0700
                Re: Fgets question Keith Thompson <kst-u@mib.org> - 2015-07-27 11:42 -0700
                Re: Fgets question Tim Rentsch <txr@alumni.caltech.edu> - 2015-07-30 15:42 -0700

csiph-web