Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Text Files Date: Mon, 26 Feb 2018 11:52:08 -0800 Organization: None to speak of Lines: 43 Message-ID: References: <5a8459d1$0$707$14726298@news.sunsite.dk> <87o9kq8gh3.fsf@bsb.me.uk> <87a7wa8040.fsf@bsb.me.uk> <87y3jsz6fm.fsf@bsb.me.uk> <6flv8d9ii03eh280a1l8sia5a1eul0bsjs@4ax.com> <9990dccb-4af6-4d66-8a03-8842bd0f92a4@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="7fc1547110f49e550839d416a90ac99b"; logging-data="17613"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18CraFog+iOIp8f/kxqASbd" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:FvY77n6qDZKhqmlTf49Rrj3xjbs= sha1:6GXlEn2mrS+MOh70H0m8PUI6F0A= Xref: csiph.com comp.lang.c:127097 supercat@casperkitty.com writes: > On Sunday, February 25, 2018 at 5:55:12 PM UTC-6, Keith Thompson wrote: >> supercat@casperkitty.com writes: >> > Many C implementations make use of external libraries or platform >> > features. Documenting all of the factors that might affect the >> > behavior of an overflow that occurs within a scanf might have been >> > impractical for some implementations. >> >> That's not an issue. The external library is part of the >> C implementation, so its documentation is part of the C >> implementation's documentation. > > Many C implementations, including gcc, consist of a compiler and runtime > library supplied by separate entities. The author of a runtime library > would generally have no way of knowing all the ways that a compiler might > replace a scanf call with something else, and the author of an implementation > would generally have no way of knowing how a library written by someone > else, or future versions thereof, would handle all corner cases. A compiler and a runtime library have to work together to make a conforming implementation. Or they can fail to do so, and the result is a non-conforming implementation. Transforming printf("hello\n") to puts("hello") is perfectly safe as long as the library is correct. Other transformations that depend on non-standard library behavior would have to be done in coordination with the library, and might have to be disabled if a different library is used. In practice, implementers don't seem to have much trouble with this concept. You needn't be outraged on their behalf. > If the Standard were to recognize a category of implementation that relies *yawn* [...] -- 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"