Programming - Errata

Errata merged July 22, 2012 by Nick Maclaren.

This is errata for the 1st printing of Programming: Principles and Practice using C++ giving the 4th printing; see that Web site for the separate, original errata.

Comments, improvements, bug reports, etc. are welcome.

I list both corrections and clarifications. There is essentially no problem that I consider too small to list, so you might find many pieces of errata too minor to bother with (I know because I have received email to that effect), but at this stage, I'd rather not make decisions about what an unknown reader will find bothersome. Please note that the number of errata does not equal the number of errors. I say this because I have seen the book condemned unread because the number of errata.

Big issues, such as "why don't you use XXX for your GUI?", "please add two more chapters on the STL", and "please use C++0x features to simplify the code" are not errata but considerations for future work and will not appear here.

Different people have different preferences for sorting errata: in chronological order, in page order, each printing separate, all printings merged, etc. However, I can't manage multiple organizations, so what you get is what seems to be most useful for most people.

At the request of repeat visitors to the page, I have started to add dates of posting of individual errata. If an errata is changed, so is its date.

As an abbreviation I use, s/before/after/ to mean replace "before" with "after".


Table of contents

Chapter 0

Chapter 1

Chapter 2

Chapter 3

  • (+4/19/2010) pg 82: s/(always rounds down)/(always rounds down; towards zero)/
  • (+4/25/2010) pg 83: s/error("you're kidding!")./simple_error("you're kidding!") using simple_error() from std_lib_facilities.h./
  • (+4/19/2010) pg 86: s/You may ...; it can be done.//
  • Chapter 4

    Chapter 5

  • (+7/7/2010) pg 168: s/, starting with the first//
  • Chapter 6

    Chapter 7

  • (+12/26/09) pg 252: exercise 4: s/declare_name()/define_name()/
  • (+5/23/2010) pg 252: exercise 4: s/global variable/variable/
  • (+12/26/09) pg 252: exercise 9: s/declare()/define()/
  • Chapter 8

  • (+6/14/2010) pg 296: s/should make such a series/should make such a sequence/
  • Chapter 9

  • (+7/5/2010) pg 335: s/long/long int/ four times.
  • Chapter 10

  • (+5/8/2010) pg 351: s/simplify all input loops by/simplify all input loops on ist by/
  • (+5/16/2010) pg 355: s/isdigit(ch)/isdigit(ch) || ch=='-'/
  • Chapter 11

    Chapter 12

  • (+5/16/2010) pg 431: s/stringstream/ostringstream/
  • (+7/9/2010) pg 433: s/, Window.h, and GUI.h/ and Simple_window.h/
  • (+3/26/2010) pg 434: pg 434: s/HTTP/HTML/
  • (+12/8/09) pg 434: Change exercise 4 to: Draw a 3-by-3 tic-tac-toe board of alternating white and red squares.
  • (+3/26/2010) pg 435: in 13: s/the superellipse shapes/the lines/
  • (+10/5/09) pg 435: in 12: s/the number of points connect to/the number of other points to connect a point to/

    Chapter 13

  • (+5/17/2010) pg 474: simplify the character literal '\"' to '"'
  • (+5/17/2010) pg 475: simplify the character literal '\"' to '"'
  • (+5/16/2010) pg 475: s/, but effective,//
  • (+6/16/2010) pg 475 s/map (see chapter 18)/map (see §21.6)/
  • (+4/25/2010) pg 476: s/RBG/RGB/
  • (+5/16/2010) pg 477: s/(e.g. see www....)/(e.g. search the web for "RGB color chart")/
  • (+5/16/2010) pg 477: s/Hexagon/Regular_hexagon/ twice
  • (+5/16/2010) pg 477: s/(a hexagon is a regular six-sided polygon)/(a regular hexagon is a six-sided polygon with all sides of equal length)/
  • Chapter 14

  • (+5/16/2010) pg 508: s/double*/double* (see Chapter 17)/
  • (+4/25/2010) pg 508: s/runtime_exception/runtime_error/
  • Chapter 15

    Chapter 16

    Chapter 17

    Chapter 18

  • (+8/14/2010) pg 643: exercise 9: s/Consider the memory layout in �17.3/Consider the memory layout in �17.4/
  • Chapter 19

  • (+7/9/2010) pg 683: Add to exercise 8: Hint: look up "placement new" and "explicit call of destructor" in a complete C++ reference.
  • (+7/5/2010) pg 683: exercise 11: s/Give the counted_ptr an initial value for the T/Let counted_ptr's constructor take an argument to be used as the initial value of the T elements/
  • Chapter 20

  • (+6/3/2010) pg 726 s/19. Define a range-checked vector for list/19. Define a range-checked iterator for list/
  • Chapter 21

  • (+6/4/2010) pg 763: s/search()/binary_search()/ 3 times
  • (+6/14/2010) pg 763: s/";see §21.6.4"/" because its cost is O(log2(N));see §21.6.4"/
  • (+6/14/2010) pg 766: s/multi_map/multimap/
  • Chapter 22

  • (+6/3/2010) pg 806: s/better checking of templates,/improved language facilities, such as/
  • Chapter 23

    Chapter 24

  • (+6/3/2010) pg 885: s/Write a double() function/Write a triple() function/
  • (+6/3/2010) pg 885: s/double/triple/ four times
  • Chapter 25

    Chapter 26

  • (+7/7/2010) pg 986 s/(O(n^2)/O(n*n)/
  • Chapter 27

    Appendix A

    Appendix B

    Appendix C

    Appendix E

    Glossary

    Bibliography

    Index


    Thanks

    Thanks to people who reported problems and often suggested remedies: Royer Alain, Tapani Alakiuttu, Petra Alm, Cassian Braconnier, Leo Carreon, Gunner Carstens, Steve Carter, Greg Cheong, Carlos E. Csiszer, J.P. Delport, Dustin Dettmer, Alessandro Gentilini, Yaakov Eisenberg, Richard Elderton, Eugene Feoktistov, Stephen Feyrer, Alessandro Gentilini, J.R. Halterlein, Christopher E. Harris, Carlos Hernandez, C.W.Holeman II, Jagadish R., Daniel Joffe, Nabil Kabbani, Christopher Keane, Prabhat Kiran, Chin-Yuan Kuo, Dirk Louis, Michael Leuschel, Teresa Leyk, Vinit Mahedia, Mark Millard, Sam Mitchell, Jaime Moreno, Akira Nakamura, Carlos Pantelides, Bob Parker, Bo Persson, Marcelo Pinto, Lukasz Piwko, Alec Ross, Robert J. Ryan, Iver Roessum David Spaniol, Alan Talbot, Dennis Tang, Kees Varekamp, Francisco Vidaller Art Werschulz, Kah-Yat Isaac Wong, Yongning Wu.