Keith Thompson <
Keith.S.T...@gmail.com> writes:
> Tim Rentsch <
tr.1...@z991.linuxsc.com> writes:
>
>> Richard Damon <Ric...@Damon-Family.org> writes:
>
> [...]
>
>>> The implementation can define ANYTHING it wants (as an extension), as
>>> long as it doesn't violate a requirement of the Standard, and the
>>> Standard explicitly provides no requirement on things it declares to
>>> be Undefined Behavior, so an Implementation is free to define that
>>> behavior as anything.
>>
>> Any construct that an implementation compiles, it defines. The behavior
>> can be defined explicitly by documenting an extension, or it can be
>> defined implicitly by what the generated code actually does. Either
>> way, the implementation defines the behavior, but the point you are
>> trying to make is not that.
>
> You can put it that way if you like, but the standard uses the
> term "implementation-defined" specifically to refer to things that must
> be documented, and "unspecified" to refer to things that may or may not
> have to be documented.
Yes, the C standard uses the terms "implementation-defined behavior"
and "unspecified behavior" with very specific meanings, along with
the corresponding shortenings "implementation-defined" and
"unspecified". My point is to distinguish the usage of words
"define" and "document" as they occur in ordinary English, and also
to avoid using phrases that might be confused with how similar
phrases are used in the C standard.
> For unspecified and not implementation-defined behavior, the
> choice of actual behavior might not even be deliberate.
Sure. What behavior results might be an accidental, unconscious,
unaware, unknowing, or even unexpected and unintended consequence of
how the compiler is written. It is still the case that the compiler
implicitly defines the behavior, by virtue of what choices are made
to produce the compiled code.
>>> [from a later posting]
>>> Yes, unfortunately, the language of the Standard doesn't give a good
>>> term for things the Implementation chooses to define but wasn't
>>> required to define.
>>
>> Yes, it does. An implementation can document an extension that
>> specifies the behavior of the construct in question.
>
> An implementation might, for example, document the order of evaluation
> of the operands to "+". I don't think that would be considered an
> extension (though the standard doesn't define the term "extension"
> precisely).
To my way of thinking any specification of behavior that goes beyond
what the C standard mandates counts as an extension (provided of
course it is documented), regardless of whether the additional
semantics falls into the realm of unspecified behavior, undefined
behavior, or even contradicts what the C standard says (assuming of
course the change has no effect on any strictly conforming program).
If the implementation wants to say that some additional semantic
rules are in effect then that needs to be documented somewhere, and
the only kinds of such documentation mentioned in the C standard are
for implementation-defined behavior, and for extensions.