Debuging using crtdbg

I am learning how to debug. According one article I have created this function.
What they don't explain is when and how to use it. What exactly to do? Should I call it ALWAYS on initiation block of program? Or should I type it somewhere into Debug settings? Should I type it only when Debug mode is selected? I don't understand what's the difference in Debug mode and Release mode in Practice, even that I know that some functions work only in Debug mode (it seems to sound intuitive that Debug is for Debug, but how to use it?). BTW I had read series of articles about Debuging with various functions but still these questions remain answers. I doubt that I should rewrite my Release code every time when I need to debug it. So if I will type in Debug mode the debug function, will they run in the Release mode too?

1
2
3
4
5
6
7
8
9
10
11
#include <crtdbg.h> // Error handling


void AssignReportingLevels()
{
   _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
   _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
   _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
   _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT);
   _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
   _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT);
Topic archived. No new replies allowed.