D
Dietmar Schindler
pete said:C99
4. Conformance
...
2 If a ‘‘shall’’ or ‘‘shall not’’ requirement
that appears outside of a constraint is violated,
the behavior is undefined.
Undefined behavior is otherwise indicated in this International
Standard by the words ‘‘undefined behavior’’
or by the omission of any explicit definition of behavior.
There is no difference in emphasis among these three;
they all describe ‘‘behavior that is undefined’’.
I can only refer to n1124, but I think you seriously misquoted the last
clause. It reads there:
they all describe "behavior that is undefined".
The quotation marks make a crucial difference. Without them, the verb
'describe' relates to 'behavior', and that behavior be undefined. This
is nonsense: behavior which is described is not undefined. With the
correct quotation, the verb 'describe' relates to the phrase 'behavior
that is undefined’’'. Thus, there is no description of behavior, but
merely a description of that phrase.
Failure to differentiate between these often leads to ridiculous
statements like "code invokes undefined behavior". Behavior which is
invoked is defined *de facto* by the result of its very invocation. It
would be acceptable to say "code has undefined behavior", which just
means "the behavior of the code is not defined by the International
Standard".
Undefined behavior, by the way, does also not mean "anything can
happen". Even if the International Standard does not forbid a certain
event, there are still other authorities, such as the laws of physics. I
get a headache every time I read about those (in)famous 'nasal demons'.
Yet, one might say that this headache is caused just by those demons
waiting to fly out of my nose.