some predefinitions
-
#ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif As to the above, I don't know what effections they can have on the other places Can you tell me their important position in the MFC AppiWizard process, or what is in the charge of them? And how do they do that? Thanks for your attention!
-
#ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif As to the above, I don't know what effections they can have on the other places Can you tell me their important position in the MFC AppiWizard process, or what is in the charge of them? And how do they do that? Thanks for your attention!
if you're performing a DEBUG build, then it redefines the
new
keyword to use theDEBUG_NEW
macro. Basically, this adds in extra error checking when allocating and freeing memory, and enables the memory leak display that gets displayed by VS when you finish debugging a program. TheTHIS_FILE[]
character array stores the current name of the file. This allows you to know the name of the current file in a form that can be manipulated. The__FILE__
macro contains the name of the file, but it is constant and can't be used everywhere that a non-constant array can. Hope this helps,Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
if you're performing a DEBUG build, then it redefines the
new
keyword to use theDEBUG_NEW
macro. Basically, this adds in extra error checking when allocating and freeing memory, and enables the memory leak display that gets displayed by VS when you finish debugging a program. TheTHIS_FILE[]
character array stores the current name of the file. This allows you to know the name of the current file in a form that can be manipulated. The__FILE__
macro contains the name of the file, but it is constant and can't be used everywhere that a non-constant array can. Hope this helps,Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
All those codes are valid when performing a debug build, do you think so? Does they work like: 1.Define "new" by "DEBUG_NEW" when detecting the building mode is debug Is that to say, "new" will always be replaced with "DEBUG_NEW", I think, DEBUG_NEW maybe contains some extra error checking codes, isn't it? 2.#undef THIS_FILE. Is it to avoid conflicting with the later same name or THIS_FILE is something to be used in a release build and it can't be used in a debug build? 3.why use "THIS_FILE[]" to substitute "THIS_FILE", can we use "THIS_FILE" directly? In the meantime, I have not see THIS_FILE[] used in another place