Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Reading lines from a file, eliminating CR and LF Date: Fri, 13 Jan 2017 12:52:32 -0800 Organization: None to speak of Lines: 51 Message-ID: References: <9a6e5204-d031-4070-88cb-8132072c5c68@googlegroups.com> <7285df88-1603-4edb-abba-b9c5e4172d34@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="5af804fde095f0102ceb1f5e23093854"; logging-data="32712"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4Qbc31tDz0nsZMVqfmtH8" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:9sqtAVcDB5DdqMvXr3HbsFodtYk= sha1:WYu1PUl4ebO8Q5K9YHWhHmnchMo= Xref: csiph.com comp.lang.c:101661 Tim Rentsch writes: > Keith Thompson writes: [...] > Looking through the Standard for uses of "requires", it seems > clear that the "requires" in 7.21.2 is used in a different sense > than most or all other uses of "requires". We know what is meant > when we say the Standard (or IEC 60559, etc) requires something. > But lines in a file don't "require" anything, at least not in the > same way that the Standard does. So the assumption that the > "requires" of 7.21.2 means the same thing it does in other places > is suspect. > > If you have a chance to look through the Standard for "requires" > (there are perhaps ten to twenty occurrences), please do and > see if you think my comments in the last paragraph are apt. I'll try to come back to this later. [...] >> What "implementation-defined property" are you referring to? If it's >> implementation-defined, there's a specific requirement in the standard >> for the behavior to be documented. > > I believe the statement in 7.21.2 is meant to say that the rules > for what happens in such cases is implementation-defined. I > agree that the actual text used doesn't express this very well, > but it's still the most sensible way of reading it that I can > find. Moreover, regardless of whether you agree that it is the > most sensible reading, I think it stands up as a /plausible/ > reading, which has been my main point all along. The actual text: Whether the last line requires a terminating new-line character is implementation-defined. doesn't express that *at all*. The thing that is implementation-defined, that the implementation is required to document, is whether the terminating new-line is required or not. It's very clear about what the implementation is required to define, namely the answer to a yes-or-no question. I see nothing suggesting that an implementation must, or even should, define what happens if the new-line is required and is not provided. -- Keith Thompson (The_Other_Keith) kst-u@mib.org 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"