Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: What constitutes "standard" C? Date: Wed, 25 Mar 2015 16:33:32 -0700 Organization: None to speak of Lines: 57 Message-ID: <87619ops8j.fsf@kst-u.example.com> References: <58082093-9db8-4795-a037-764012b7f76b@googlegroups.com> <3eLKw.50412$895.40124@fx08.iad> <87wq2s4bmz.fsf@kst-u.example.com> <87lhilqdlr.fsf@kst-u.example.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="c77ff4d35e33d1c939d3461ebde8dd0d"; logging-data="30564"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2WhuQJ0vkv2HRGqsAUIIz" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:ycVIxUMl6E/EiXMftMX6N0Y/ji4= sha1:AZeEid5abF/4Mj0yqM/Pwdz1RoA= Xref: csiph.com comp.lang.c:58985 Tim Rentsch writes: > Keith Thompson writes: [...] >>>> On 3/7/15 6:43 PM, Keith Thompson wrote: [...] >> So back to my previous question: >> >>>>> Concretely, can anyone cite an example of a real-world compiler >>>>> "accepting" a translation unit but failing to translate it? > > In a way, yes. Running out of memory during a compile (or to > give a perhaps more plausible example, file system full) is a > case that counta, I would say, as "accepting" the TU, because > it wasn't "rejected". Suppose we have two nearly identical translation units. Both exceed the resource requirements of the compiler; it runs out of memory about halfway through. The first is otherwise syntaxctically and semantically valid. The second is identical except for a missing } at the end. I'd expect the compiler to behave identically for both, dying with a fatal error message when it runs out of memory and terminating. It doesn't seem reasonable to expect the compiler to continue processing so it can detect the missing }. Do you think the standard requires it to do so? And, again, do you have a concrete example of a real-world compiler making this distinction? >> Narrowing the question slightly, is there a concrete example not >> involving the #error directive? (I find it implausible that #error >> would be the only distinction between accepting and translating a >> translation unit.) If a translation unit exceeds the compile-time >> memory capacity of an implementation, is the compiler still required to >> "accept" it? > > In a nutshell, here is my view: > > "accept" is the opposite of "reject". > > To "reject" a program means refusing to translate it (as opposed > to being unable to translate for some other reason) because > the source does not conform to what the compiler considers > the minimum extent of the language. > > Being unable to translate a program (ie, TU) is not a rejection, > just a limitation of what the compiler can do. Any TU not > explicitly "rejected" (denied translation, as opposed to being > unable to translate) is "accepted". If the compiler dies with a fatal error message before it's able to detect the missing }, has it "accepted" the translation unit? -- 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"