hsf-training / cpluspluscourse

C++ Course Taught at CERN, from Sebastien Ponce (LHCb)
Apache License 2.0
169 stars 65 forks source link

Simplify debug exercise #471

Closed hageboeck closed 1 year ago

hageboeck commented 1 year ago

In addition to the work in #468, I propose to simplify the code. It seemed to be complicated enough that we didn't fix an out-of-bounds access in the solution, so here I propose to take the randomness out of the exercise, and go for a simple reverse.

During the C++ course at JLab, a mentor suggested to add a check for correctness, which is trivial when the collection just has to be reversed.

I did a similar thing for the valgrind part, but I added an off-by-one mistake in the reverse function, and a memory leak in main. That should hopefully be enough for people to find.

Note: Either close #468 and merge the current one, or merge #468 and this gets rebased.