The following will be discussed in this chapter: Constructing LALR parsing tables, efficient construction of LALR parsing tables, compaction of LR parsing tables, ambiguous grammars, precedence and associativity t o resolve conflicts, the "dangling-else" ambiguity, error recovery in LR parsing. | LESSON 22 Overview of Previous Lesson(s) Over View Assertions assert() library function is declared in the cassert header to check logical conditions in native C++ program that should always be true. _DEBUG symbol The preprocessor symbol DEBUG is automatically defined in the debug version of a native C++program. 3 Over View Debugging code Add our own debugging code by enclosing it between an #ifdef / #endif pair of directives testing for DEBUG. header The header supplies declarations for functions to provide debugging of free store operations. 4 Over View _crtDbgFlag flag By setting the crtDbgFlag appropriately enables automatic checking of program for memory leaks. Debug output To direct output messages from the free store debugging functions, we can call the CrtSetReportMode() and CrtSetReportFile() functions. 5 Over View. Debugging Dynamic Memory Allocating memory dynamically is a major source of bugs. In this context most common bugs are memory leaks. Sometimes, this can result in a tragic failure of the program when all available memory has been allocated. 6 Over View. Problem diagnosed Name class is allocating memory for its data members, and never releasing it. The problem is that in implementing the class, we forgot the fundamental rules related to classes. Solution A destructor A copy constructor The assignment operator. 7 TODAY’S LESSON Contents C++ / CLI Programming Using the Debug and Trace Classes Generating Output Setting the Output Destination Indenting the Output Controlling Output Assertions Program 9 Debugging CLI Programs Life is simpler with C++/CLI programming. No complications of corrupted pointers or memory leaks arise in CLR programs, so this reduces the debugging problem substantially. Breakpoints and tracepoints can be set exactly the same way. 10 Debugging CLI Programs We have a specific option that applies to C++/CLI code for preventing the debugger from stepping through library code. 11 Debug & Trace Classes The | LESSON 22 Overview of Previous Lesson(s) Over View Assertions assert() library function is declared in the cassert header to check logical conditions in native C++ program that should always be true. _DEBUG symbol The preprocessor symbol DEBUG is automatically defined in the debug version of a native C++program. 3 Over View Debugging code Add our own debugging code by enclosing it between an #ifdef / #endif pair of directives testing for DEBUG. header The header supplies declarations for functions to provide debugging of free store operations. 4 Over View _crtDbgFlag flag By setting the crtDbgFlag appropriately enables automatic checking of program for memory leaks. Debug output To direct output messages from the free store debugging functions, we can call the CrtSetReportMode() and CrtSetReportFile() functions. 5 Over View. Debugging Dynamic Memory Allocating memory dynamically is a major source of bugs. In this context most common bugs are memory leaks. .