Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Organized non-portable behavior in a table.

...

The C99 standard identifies four different kinds of non-portable behavior:

...

. Each section of Annex J

...

of the C99 standard enumerates distinct instances of behaviors of each kind.

Nonportable Behavior

Definition

Annex J Section

unspecified behavior

Behavior for which the standard provides two or more possibilities and imposes no further requirements on which is chosen in any instance.

J.1

undefined behavior

Behavior, upon use of a nonportable or erroneous program construct or of erroneous data, for which the standard imposes no requirements. An example of undefined behavior is the behavior on integer overflow.

J.2

implementation-defined behavior

Unspecified behavior whereby

Sections 1 through 4 of Annex J of the C99 standard enumerate distinct instances of unspecified, undefined, implementation-defined, and locale-specific behavior, respectively.

C99 Section 3.4.1 defines implementation-defined behavior as

...

each implementation documents how the choice is made.

J.3

locale-specific behavior

Behavior that depends on local conventions of nationality, culture, and language that each implementation documents.

J.4

An example of implementation-defined behavior is the propagation of the high-order bit when a signed integer is shifted right.C99 Section 3.4.4 defines unspecified behavior as

...

An example of unspecified behavior is the order in which the arguments to a function are evaluated.

...