17

Going through the book, its feels like I hit mistakes in a few sections. (For a book of such length, it seems normal that glitches and errors would find their way in.)

The only errata I found was on InformIT, but its last modification is dated from 9 October 2012, less than 2 months after the book's release (and almost three years ago).

Is someone aware of an official or unofficial errata, that would have been maintained since the book's release?

Tom Zych
  • 13,329
  • 9
  • 36
  • 53
Ad N
  • 7,930
  • 6
  • 36
  • 80
  • 2
    Why is this voted as off-topic ? This book is highly regarded for C++ programming, yet does not seem to provide an updated errata, which would be a great asset for developers reading it. As an example of potential error not appearing in the errata found on InformIT, see [this question](http://stackoverflow.com/q/30866204/1027706) – Ad N Jun 16 '15 at 11:29
  • See [#4](https://stackoverflow.com/help/on-topic) and what your answer should be about in the header. – edmz Jun 16 '15 at 15:06
  • 1
    Pff, so somebody added a bounty to this question, so It cannot be flagged as being off-topic...While it clearly fits into category #4, as described by black. – JHBonarius Apr 13 '17 at 14:50
  • 1
    one mistake I've found is on p. 108, in the 2nd paragraph under section `Iterator Types`: "a `const_iterator` behaves like a `const` pointer...". I think "a pointer to `const`" should be used here instead. – Yibo Yang May 14 '17 at 16:00
  • 1
    Another error was found, you can check it out at: https://stackoverflow.com/q/66515465/12496872 – Jason May 07 '21 at 16:20
  • @YiboYang Although this wasn't reflected in errata page, the paragraph you said has been updated in sixth printing as follows: "A `const_iterator` behaves like a pointer to `const` pointer (§ 2.4.2, p. 62). Like a pointer `const`, a `const_iterator` may read but not write the element it denotes; an object of type `iterator` can both read and write." – rosshjb Oct 03 '21 at 08:39

1 Answers1

4

This is not exactly your answer but I would suggest you to take a look at the "jaege" and "adobrich" repositories on the Github. There are solutions to exercises for every chapter and perhaps you could find your answer by looking at the solutions. "Jaege" has covered all the chapters but "adobrich" reached the chapter 6. I Hope it helps.

Solutions to Exercises in C++ Primer 5th Edition by jaege

Solutions to C++ Primer 5th Edition by adobrich

Ali.Ghodrat
  • 3,348
  • 3
  • 31
  • 31
  • I found wrong answers in both repositories. Unless I misunderstood something, since I'm a beginner learning C++ (and that's why I read C++ Primer!). For example, jaege 4.35 `fval = ui - ival * 1.0;` says `ival` is converted to *double* before multiplication, which is true, but then the result is converted to an unsigned int before subtraction, which is false. According to the book, arithmetic operations between integers and floating point numbers convert to the latter. And indeed testing with e.g. `auto test = ui - ival * 1.0;` results with the type of `test` being `double`. – Markus von Broady Aug 10 '21 at 15:14