Click here to Skip to main content
15,886,519 members
Articles / Programming Languages / C++

Extended Debug Macros

Rate me:
Please Sign up or sign in to vote.
2.00/5 (5 votes)
13 Jun 20011 min read 54.6K   723   11  
A set of debug macros for checking expressions that work in
#define __MYDEBUG__  //debug macro -- debug/release version�� ��� �̿�!!

#ifdef __MYDEBUG__

#define CHECKVOIDFUNC(bEXPRESSION, ERRORMSG)		        if(!(bEXPRESSION)) { AfxMessageBox(ERRORMSG); return;};
#define CHECKFUNC(bEXPRESSION, ERRORMSG, RETURNVALUE)		if(!(bEXPRESSION)) { AfxMessageBox(ERRORMSG); return RETURNVALUE ;};

#define CHECKVOIDEXPR(bEXPRESSION, ERRORMSG)                  CHECKVOIDFUNC(bEXPRESSION, ERRORMSG)
#define CHECKEXPR(bEXPRESSION, ERRORMSG, RETURNVALUE)         CHECKFUNC(bEXPRESSION, ERRORMSG, RETURNVALUE)    

#define EXITCHECKEXPR(bEXPRESSION,ERRORMSG, RETURNVALUE)	if(!(bEXPRESSION)){\
				if(AfxMessageBox(CString(ERRORMSG)+CString("\n\n���α׷��� �����ðڽ��ϱ�?"), MB_YESNO) == IDYES)\
				  exit(-1);\
				else return RETURNVALUE;};\
				  
#define EXITCHECKVOIDEXPR(bEXPRESSION,ERRORMSG)	if(!(bEXPRESSION)){\
				if(AfxMessageBox(CString(ERRORMSG)+CString("\n\n���α׷��� �����ðڽ��ϱ�?"), MB_YESNO) == IDYES)\
				  exit(-1);\
				else return ;};\

#define EXITCHECKVOIDFUNC(bEXPRESSION,ERRORMSG)                   EXITCHECKVOIDEXPR(bEXPRESSION,ERRORMSG)
#define EXITCHECKFUNC(bEXPRESSION,ERRORMSG, RETURNVALUE)          EXITCHECKEXPR(bEXPRESSION,ERRORMSG, RETURNVALUE)

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions