Advertisement
Tkap1

Untitled

Jan 5th, 2023
1,001
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #define assert(cond) if(!(cond)) \
  2. { \
  3.     debug_print("\nassert failed at: %s (%d)\n", __FILE__, __LINE__); \
  4.     if(IsDebuggerPresent()) \
  5.     { \
  6.         __debugbreak(); \
  7.     } \
  8.     char assert_buffer[256] = {}; \
  9.     sprintf_s(assert_buffer, sizeof(assert_buffer), "%s\n%s\n%s (%i)", #cond, __FUNCTION__, __FILE__, __LINE__); \
  10.     int assert_box_result = MessageBox( \
  11.         null, \
  12.         assert_buffer, \
  13.         "Assertion failed", \
  14.         MB_RETRYCANCEL | MB_ICONERROR \
  15.     ); \
  16.     if(assert_box_result == 2) \
  17.     { \
  18.         exit(1); \
  19.     } \
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement