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: Using fread function Date: Mon, 20 Feb 2017 09:52:08 -0800 Organization: None to speak of Lines: 63 Message-ID: References: <02c75a0c-84d7-4669-8bde-472730c7f8d3@googlegroups.com> <79af9f0c-d7e1-ef68-d186-f1ce0baa9e6c@verizon.net> <05a6afe0-d7db-4877-a244-1c5c7bc8e928@googlegroups.com> <28dc26c8-8063-4334-9850-b1a5ba7876f3@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="9029eb194d173f90c26f49eb1843bbfe"; logging-data="9995"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rdfy92895y3AEQ0yK9Aji" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:KNTrBMmbl2JMoDH+ccIrbSZZyRE= sha1:ijvEolTRAofURelf4TDw3QQLLCY= Xref: csiph.com comp.lang.c:104280 supercat@casperkitty.com writes: > On Sunday, February 19, 2017 at 11:19:50 PM UTC-6, Tim Rentsch wrote: >> supercat writes: >> > The "language" in which Strictly Conforming programs can be written may be >> > usable for some purposes, but it is totally unsuitable for most of the >> > tasks which are performed by programs written in various dialects of C. >> >> You are confusing two different classes of program here, to wit, >> programs that are written in standard C, and programs that are >> strictly conforming. My comment is about standard C, not about >> C programs that are strictly conforming. > > The Standard defines two classes of programs: those which are Strictly > Conforming, and those which are Conforming but not Strictly Conforming. > I would interpret the class of "Strictly Conforming" programs as including > some which make use of some implementation-defined behaviors but will meet > their stated requirements with any combination of such behaviors that > conforming implementations could define (and thus to not rely upon any > Implementation Defined behaviors being defined in any *particular* fashion). Isn't it simpler (and more accurate) just to use the definition in the standard? A strictly conforming program shall use only those features of the language and library specified in this International Standard. It shall not produce output dependent on any unspecified, undefined, or implementation-defined behavior, and shall not exceed any minimum implementation limit. A program that's required to print the value of INT_MAX will meet its stated requirement, but it cannot be strictly conforming because its output depends on something that's implementation-defined. (I'm assuming that the implementation-defined value of INT_MAX constitutes implementation-defined behavior. If not, it shouldn't be difficult to construct another example.) Strict comformance is, as the name implies, a strict requirement, one that most programs don't meet. A "conforming program" is "one that is acceptable to a conforming implementation". This includes programs that depend on implementation-specific extensions, or even on undefined behavior. Since a conforming implementation may *accept* a program containing `i = i++`, such a program can be "conforming". It is an almost uselessly wide category. > The Standard does not define any category of "Standard C" programs other > than the above, and the category of "Conforming" programs is so broad that > I don't think all such programs can be meaningfully described as being in > the same language, so if you're not referring to the category of "Strictly > Conforming" programs extended as above, to what are you referring? There's also this (4p3): A program that is correct in all other aspects, operating on correct data, containing unspecified behavior shall be a correct program and act in accordance with 5.1.2.3. -- 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"