...
- A pointer to a character string describing the runtime-constraint violation.
- A null NULL pointer or a pointer to an implementation defined object.
- 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 typeerrno_t
is passed.
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 NULL pointer. The behavior of the default handler is implementation-defined, and it may cause the program to exit or abort.
...
Code Block | ||
---|---|---|
| ||
errno_t function(char * dst1, size_t size){ char src1[100] = "hello"; if (strcpy_s(dst1, size, src1) != 0) { return -1; } /* ... */ return 0; } |
...
Code Block | ||
---|---|---|
| ||
constraint_handler_t handle_errors() { /* handle runtime-constraint error */ } /*...*/ set_constraint_handler(handle_errors); /*...*/ /* Returns zero on success */ errno_t function(char * dst1, size_t size){ char src1[100] = "hello"; if (strcpy_s(dst1, size, src1) != 0) { return -1; } /* ... */ return 0; } |
...