Newsgroups: comp.std.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: What's implementation defined? Message-ID: <1988Dec3.224807.29121@utzoo.uucp> Organization: U of Toronto Zoology References: <8457@alice.UUCP> <219@twwells.uucp> <1988Nov28.215053.3129@utzoo.uucp> <229@twwells.uucp> <9034@smoke.BRL.MIL> Date: Sat, 3 Dec 88 22:48:07 GMT In article <9034@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) writes: >-: No; what we have here is a situation in which the legality of such a >-: program is implementation-defined. It is not improper to fail to translate >-: an illegal program. >-Since this kind of thing occurs throughout the standard, I'm forced >-to conclude that they intended that some things can be implementation >-defined to be incorrect, regardless of the stated definition of >-"implementation defined". > >This is a misreading of the proposed standard. "Implementation defined" >does not give license to fail to translate the program. See the final >Rationale document. Note that the Rationale is not part of the standard. However, this was sloppy terminology on my part -- I should have said "implementation-specific" or something else that doesn't have a magic meaning in the standard. My point was, it's quite possible to write programs whose legality depends on implementation-defined assumptions. The supplier is required to document the "values of" implementation-defined characteristics, and refusal to compile is not a legal "value" (but see below). However, it is quite possibly to define a program whose individual parts are legal but which in toto is illegal because of implementation-defined characteristics. Dennis's example is a typical case: int x; enum e x; If "enum e" was otherwise legally declared, the type given to x by the second line is implementation-defined, but the compiler is not allowed to refuse to compile it, in isolation. However, whether this is legal in the context of the first line depends on exactly what that type is. Also, returning for a moment to refusal to compile not being an option, the ice is thin here in places. For example, one can write something like "#include x y z" where x, y, and z are macros, and the manner in which the resulting preprocessor tokens between (e.g.) a `<' and a `>' are combined into a single header name is implementation-defined. That means the combination has to happen, somehow. However, there is no guarantee that the combination function will yield useful results. -- SunOSish, adj: requiring | Henry Spencer at U of Toronto Zoology 32-bit bug numbers. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu