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 currently registered runtime-constraint handler is called.

...

Code Block
bgColor#ccccff
_invalid_parameter_handler handle_errors(const wchar_t* expression,
   const wchar_t* function, 
   const wchar_t* file, 
   unsigned int line, 
   uintptr_t pReserved)
{
/*define what to do when error occurs*/
}

/*...*/

_set_invalid_parameter_handler(handle_errors)

/*...*/

errno_t function(char *dst1){
  char src1[100] = "hello";

  if (strcpy_s( dst1, sizeof(dst1), src1) != 0) {
    return -1;
  }
  /* ...  */
  return 0;
}

...