Undefined value

This include numerous arithmetical cases such as division by zero, square root or logarithm of a negative number etc.

Signal handlers can attempt some forms of recovery, such as terminating part of a computation, but without as much flexibility as fully integrated exception handling.

Examples fall into two categories: All of the preceding methods of handling undefined values require that the undefinedness be detected.

That is, the called function determines that it cannot return a normal result and takes some action to notify the caller.

At the other end of the spectrum, undefined behaviour places the onus on the caller to avoid calling a function with arguments outside of its domain.

Therefore, computer hardware and low-level languages such as C do not attempt to validate pointers before dereferencing them, instead passing responsibility to the programmer.

For example, the C library strftime function converts a timestamp to human-readable form in a supplied output buffer.

It is common to use a two-argument form of open, which provides an undefined value for the file mode, when O_CREAT is omitted.

Safely handling undefined values is important in optimistic concurrency control systems, which detect race conditions after the fact.

For example, reading a shared variable protected by seqlock will produce an undefined value before determining that a race condition happened.