What's implementation defined?

Henry Spencer henry at utzoo.uucp
Sun Dec 4 08:48:07 AEST 1988


In article <9034 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) 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 at zoo.toronto.edu



More information about the Comp.std.c mailing list