Jump to: navigation, search

Implementation-defined behavior is defined by the ISO C Standard in section 3.4.1 as:

unspecified behavior where each implementation documents how the choice is made

EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit when a signed integer is shifted right.

Any code that relies on implementation defined behaviour is only guaranteed to work under a specific platform and/or compiler. Portable programs should try to avoid such behaviour.

Quick examples

Trying to allocate 0 bytes of memory using

int *o = malloc(0 * sizeof *o);

may result in o either being NULL or a unique pointer (as specified in 7.20.3 of the C99 Standard).

See also

References

  • ISO C99 Standard, 3.4.1
Personal tools