if I have the following function
Assuming _DEBUG was not defined, would the compiler generate any extra instruction in this if statement?Code:inline void SHOWERROR(char *str) { #ifdef _DEBUG char buf[1024]; char file[] = __FILE__; int line = __LINE__; sprintf(buf, "File: %s\nLine: %d\n%s", file, line, str); MessageBox(0, buf, "Error", 0); #endif }
or would it be better to use something like thisCode:if (!(memcpy(pDest, pSource, size) ) ) { SHOWERROR("Error Message"); }
Code:#define SHOWERROR(s) { char buf[1024]; \ char file[] = __FILE__; \ int line = __LINE__; \ sprintf(buf, "File: %s\nLine: %d\n%s",file,line,s); \ MessageBox(0, buf, "Error", 0); } ... if (!(memcpy(pDest, pSource, size) ) ) { #ifdef _DEBUG SHOWERROR("Error Message"); #endif }



LinkBack URL
About LinkBacks


