debug.cpp

来自「使用BorlandC++4.5编译的一个MUD客户端程序」· C++ 代码 · 共 56 行

CPP
56 行
字号
// ------------------------------------------------------------------------
// debug.cpp - debugging and error-checking routines
//
// $Id: debug.cpp 2.2 1995/10/27 20:05:02 tsurace Beta $
// $Log: debug.cpp $// Revision 2.2  1995/10/27  20:05:02  tsurace// Modified formatting of ASSERT failure dialog.//
// Revision 2.1  1995/10/24  15:52:51  tsurace
// Roll.
//
// Revision 1.1  1995/10/11  20:59:54  tsurace
// Initial revision
//
// (end of log)

#define  STRICT
#include <windows.h>
#pragma hdrstop

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "debug.hpp"

// ------------------------------------------------------------------------
// _MyWin32Assert - assertion failure function
//
// Note that at this point I am hoping that, because *I* caught this
// with an ASSERT macro, there hasn't been a fatal app error yet.
//
void _MyWin32Assert(const char * prm,    //                80
                    const char * file,   // max width used 40 
                    int          line,   //                40  
                    const char * comment) //               80

{
    static char msg[275];  // Big enough, I reck'n
    sprintf (msg,
             "'%.80s'\n%.40s:%-40d\n%.80s",
             prm,      file, line,  comment);
             
    // Parentless, system-modal info message, limited to 3 lines,
    // but will show regardless of the status of system memory
    MessageBox(NULL,
               msg,
               "ASSERT failure!",
               MB_SYSTEMMODAL | MB_ICONHAND | MB_OK);
    
    DebugBreak();             // Crap out or stop
    abort();
};

// EOF //

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?