Advertisement
Guest User

continue_on_invalid_param.cpp

a guest
Jun 10th, 2012
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. /*
  2.  * _continue_on_invalid_param.c
  3.  * author: Anselm Kruis, <a.kruis@science-computing.de>
  4.  *
  5.  * This file has no copyright assigned and is placed in the Public Domain.
  6.  * No warranty is given.
  7.  *
  8.  */
  9. # if __MSVCRT_VERSION__ >= 0x800
  10.  
  11. #include <stdlib.h>
  12.  
  13. #ifdef _DEBUG
  14. /* #include <crtdbg.h>  not available  */
  15. #ifndef _CRT_ASSERT
  16. #define _CRT_ASSERT         2
  17. #endif
  18. extern "C" {
  19. int __cdecl _CrtSetReportMode(int, int);
  20. }
  21. #endif
  22.  
  23. extern "C" {
  24.  
  25. static void __cdecl _nullInvalidParameterHandler(
  26.    const wchar_t* expression,
  27.    const wchar_t* function,
  28.    const wchar_t* file,
  29.    unsigned int line,
  30.    uintptr_t pReserved)
  31. {
  32.     return;
  33. }
  34.  
  35. static int __cdecl set_continue_on_invalid_param(void) {
  36.    _set_invalid_parameter_handler(_nullInvalidParameterHandler);
  37. #ifdef _DEBUG
  38.    /* in _DEBUG mode, an _ASSERT is done as well! */
  39.    _CrtSetReportMode(_CRT_ASSERT, 0);
  40. #endif
  41.    return 0;
  42. }
  43.  
  44. } // extern "C"
  45.  
  46. static int init = set_continue_on_invalid_param();
  47.  
  48. #endif /* # if __MSVCRT_VERSION__ >= 0x800 */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement