Skip to content

Solutions to the exercises found in _C++ for C Programmers, Third Edition_ by Ira Pohl

License

Notifications You must be signed in to change notification settings

chaiken/Cpp-exercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The source files here are my solutions to the exercises in _C++ for C Programmers, Third Edition_ by Richard Pohl.   Unsurprisingly, some code snippets were part of the exercises' problem statement, and so were not written by me.   The rest is my own work.  If you are sceptical, try reading the code (snort).

The programs were originally written with C++11 in mind, as that's what then employer had selected.  I thank the poor code reviewers who read my programs that predate the ones here for their immense patience.   As of 2022, I've switched employers and adopted C++17.

The files called *_test.cc will not compile without a copy of the googletest sources placed at the path GTEST_DIR:

GTEST_DIR = $(HOME)/gitsrc/googletest/googletest

googletest is available at [email protected]:google/googletest.git

As a compiler, as of 11/18/18, I'm using g++ (Debian 8.2.0-9) 8.2.0.  Note that the Makefile incorporates -fsanitize=address for the default CXXFLAGS.  As of 5/25/20, the first pass at all the exercises in the text is complete.   As of 10/10/2020, unit tests cover over 95% of the code with the notable exception of bad allocations.   I tried specifying alternate allocators as template parameters and overloading "new" but could not figure out how to make the test code get nullptr allocations while the libraries did not.   gcov shows artificially low coverage numbers because it does not understand googletest DEATH tests.

As of 2022, I've replaced all necessary assertions with exceptions and removed googletest DEATH tests.   Also gone are instances of raw "new", replaced by smart ptrs.   With these changes, the code passes clang-tidy and valgrind and achieves 99.4% test coverage.

About

Solutions to the exercises found in _C++ for C Programmers, Third Edition_ by Ira Pohl

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published