Wrox Programmer Forums
|
BOOK: Ivor Horton's Beginning Visual C++ 2008 ISBN: 978-0-470-22590-5
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2008 by Ivor Horton; ISBN: 9780470225905
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2008 ISBN: 978-0-470-22590-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 9th, 2011, 01:52 PM
Registered User
 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default My sugestions to this book

1. Page 184: "In this case the type name should be enclosed between parenthess". I think that according to ISO/IEC C++ standard and MSDN in this case it must be enclosed between parenthess.
2. Page 189: It is more convenient for found variable to be bool type i.e.: bool found = false; etc.
3. In above example it is very easy to get "only division by primes less than or equal the square root" functionality: just get #include <cmath> and change "i < count" (i.e. in "Try division by existing primes") to "i <= static_cast<int>(sqrt(static_cast<double>(count))) ".
4. Page 211 Ex4_13: Of course this code works greatly, but I think is more convenient (and safe) to use double max = Double.MinValue;
5. Page 215 "otherwise a negative number is returned". You may think what that negative number really means (why not just -1 ?). It is a "inverted position" where toBeFound value needs to be added in way that array is still in ascending order. For example -3 means that if we will put searched number on third position (counting from one, not zero) to array then it keeps order. In other words the result (if number is not found) is (-(insertion point) - 1) where insertion point is index where toBeFound would be inserted into the array.
6. Page 218 Ex4_16: SIZE don't have to be const, you can use ordinary auto variable. I think that later you can use GetLength() method (number of elements in the specified dimension of the Array) instead of SIZE. For example products.GetLength(0) return 32-bit integer with number of rows and products.GetLength(1) number of colums. I think it is more readable in this way.
7. Page 245 "but it's better to specify the fact by using the keyword void". In C++ language there is no difference between f() and f(void), but if you also programming in "old" C language, then it's far better (positive habit) to use f(void).
8. Page 335 Ex7_01. You can write long Area(const RECTANGLE& aRect) (i.e. const in declaration and definition). In this way you tell: "I don't touch (modify) this struct".
9. Page 338 "function InflateRect() to increase the size of a rectangle" change to "function InflateRect() to increase or decrease the size of a rectangle".
10. Page 339 Figure 7-3 If you are interested in, more concrete it is singly-linked list (one way none-circular list). There is also doubly-linked list. (struct have also pPrev pointer to previous object in chain, i.e. LE1 will have pPrev = 0 sometimes called NIL). In addition LE1 (first element) is a head and LE5 (last element) is a tail.
11. Page 362-363 Ex7_08 You can use inline double BoxSurface(const CBox& aBox). I this way a) whole aBox object is not copied b) function is explicitly inline.
12. Page 367 Ex7_10 You can use bool Compare(CBox xBox). Also you can implement int Compare(CBox xBox) in more extensive way to return: -1 when this->Volume() < xBox.Volume(), 0 when this->Volume() == xBox.Volume() and 1 when this->Volume() > xBox.Volume().
13. Page 369 code listing double Volume() also need to be changed to double Volume() const
14. Page 375 "The code show that it doesn't matter how you refer to the static member ObjectCount". It is true, but I think you should stick with CBox::objectCount notation. For example in Eclipse (Java language, but the same mechanism) you will get warning: "The static field CBox.objectCount should be accesed in static way" for access through object.
15. Page 415: Also be careful with '=' operator. For example: CMessage motto2 = motto1; involves copy constructor, but CMessage motto2; motto2 = motto1 is another "demon lurking in free store" because it involves default '=' operator, so you really need to think about overload this operator.
16. Page 420 Also you can't overload typeid operator.
17. Page 451 Division operator function header should be: int operator/(const CBox& aBox) const (you need to add const, because of operator% function, which has first argument const CBox& aBox).

Last edited by gszpetkowski; January 17th, 2011 at 11:46 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help,I can't find my book in your book list. 5uer All Other Wrox Books 2 August 21st, 2004 12:43 AM
I can't find my book in your book list. duxn_79 All Other Wrox Books 2 July 13th, 2004 01:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.