Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated references from C11->C23

The C Standard, subclause 3.45.3 [ISO/IEC 9899:20112024], defines undefined behavior as

behavior, upon use of a nonportable or erroneous program construct or of erroneous data, for

which this International Standard

which this document imposes no requirements

.

Subclause 4 explains how the standard identifies undefined behavior (see also undefined behavior 1 of Annex J).

If a "shall" or "shall not" requirement that appears outside of a

constraint is violated

constraint or runtime-constraint is violated, the behavior is undefined. Undefined behavior is otherwise indicated in this

International Standard by the

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

Annex J, subclause J.2, "Undefined behavior," enumerates the circumstances under which the behavior of a program is undefined. This list is duplicated on the CC. Undefined Behavior page.

...

Bibliography

[ISO/IEC 9899:20112024]Subclause 3.45.3, "Undefined Behavior"
Subclause 4, "Conformance"
Subclause J.2, "Undefined Behavior"
[Seacord 2013]Chapter 5, "Integer Security"

...