Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

TR24731-1 provides a consistent mechanism to handle constraints violations that are discerned at runtime. Most functions defined by TR24731-1 include as part of their specification a list of runtime-constraints. Library implementations must verify that the runtime-constraints for a function are not violated by the program. If a runtime-constraint is violated, the runtime-constraint handler currently registered runtime-with set_constraint_handler_s() is called.

When the handler is called, it is passed the following arguments in the following order:

  1. A pointer to a character string describing the runtime-constraint violation.
  2. A null pointer or a pointer to an implementation defined object.
  3. If the function calling the handler has a return type declared as errno_t, the return value of the function is passed. Otherwise, a positive value of type
    errno_t is passed.

A runtime-constraint handler is registered by calling the set_constraint_handler_s() function.

The implementation has a default constraint handler that is used if no calls to the set_constraint_handler_s() function have been made or the handler argument to set_constraint_handler_s() is a null pointer. The behavior of the
default handler is implementation-defined, and it may cause the program to exit or abort.If the handler argument to set_constraint_handler_s() is a null pointer, the implementation default handler becomes the current constraint handler.

Section 6.1.4 states:

These runtime-constraints are requirements on the program using the library.

...