You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

C99 defines undefined behavior in Section 3.4.3 as:

behavior, upon use of a nonportable or erroneous program construct or of erroneous data, for which this International Standard imposes no requirements

NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment (with or without the issuance of a diagnostic message), to terminating a translation or execution (with the issuance of a diagnostic message).

EXAMPLE An example of undefined behavior is the behavior on integer overflow.

C99 Section 4 describes the manner in which a conforming implementation can deal with undefined behavior.

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".

Undefined behavior enters the standard for a variety of reasons.

C99 describes the manner in which a conforming implementation can deal with undefined behavior.

  • No labels