Week 13 Class 23 Tue Apr 08 Posted: Apr 08
After Class
std::exception
Hierarchy Crossword The Brightspace assignment submission is now open.Announcements
v3a
.Agenda
Exercise 68: FileIO
The program ReadFile supports multiple ways to read from standard input. You run the program with the option on the command line. The options include get, read, and fileread:
All is well and good, but the program has memory leaks with some options. Use valgrind to determine what the problem is, fix it, and commit your fix. Do not make any other changes.
Valgrind performs dynamic analysis, which means it collects data during the execution of a program. For valgrind, running with one option (e.g., using the option get) may find an issue, but running with another option (e.g., using the option read) may not. To be sure, we have to run the program with all options.
The build command is:
To run with valgrind for option get:
This command is a single line displayed using the line continuation character ("\"). You can copy and paste the entire command.
You must run the command with each option, get, read, and fileread.
The fix consists of only one change to the code. Your code must pass with a clean valgrind report for all three options.
The GitHub Classroom link is in Brightspace.
Notes: Errors and Exception Handling
RAIIDataMembers Situation that shows why you should always use RAII types for your data members, and not try to do the memory management outside of that.
std::exception
Hierarchy CrosswordUnless otherwise noted, exercises are due by 4:30 pm on Wed Apr 09