PrintNumber | ErrorLocation | Error | Correction | DateAdded |
---|---|---|---|---|
2 | pii | Second Printing August 2012 | Third Printing: April 2013 | 6/28/2012 |
2 | p7 | Years of evolution resulted in C++ being widely accepted and adopted albeit in many different forms because of the many different compilers, which each having its own idiosyncrasies. | Years of evolution resulted in C++ being widely accepted and adopted albeit in many different forms because of the many different compilers, with each having its own idiosyncrasies. | 4/1/2013 |
2 | p8 | Note that the microprocessor cannot consume text files, which is essentially what you create when you program. Compilation is the step where code in C++ contained typically in .CPP text files is converted into byte code that the processor can eventually understand. | When you compose a program in C++, you are essentially creating text files that are typically saved with .CPP as the file extension. However, a microprocessor is designed to consume instructions in binary, not the plain text you programmed in. Compilation is the step where C++ code contained in the CPP text files is converted into byte code that the processor can eventually execute. | 4/1/2013 |
2 | p9 | Bottom of page, the numbers 1.-3. should be bold. | fixed | 4/1/2013 |
2 | p10 | Bottom of page, the numbers 1.-3. should be bold. | fixed | 4/2/2013 |
2 | p11 | Executing .\hello on Linux or Hello.exe on Windows returns the following output: | Executing ./hello on Linux or Hello.exe on Windows returns the following output: | 4/2/2013 |
2 | p24 | The statement shows cout followed by the insertion operator << (that helps insert data into the output stream), followed by the string literal Hello World to be inserted, followed by a newline in the form of std::endl (pronounced standard end-line). | The statement shows cout followed by the insertion operator << (that helps insert data into the output stream), followed by the string literal Hello World to be inserted, followed by a new line in the form of std::endl (pronounced standard end-line). | 4/2/2013 |
2 | p32 | Variables names also cannot be reserved keywords. | Variable names also cannot be reserved keywords. | 4/2/2013 |
2 | p40 | So, if you want to store the value of pi (22 / 7 or 3.14) in a variable in C++, you would use a floating-point type. | So, if you want to store the value of Pi (22 / 7 or 3.14) in a variable in C++, you would use a floating-point type. | 4/2/2013 |
2 | p50 | You may want to take a look at Listings 6.4 and 6.5 in Lesson 6,Controlling Program Flow. | You may want to take a look at Listings 6.4 and 6.5 in Lesson 6, Controlling Program Flow. | 4/2/2013 |
2 | p59 | You can initialize all elements of an array to one value, like this: int MyNumbers [5] = {100}; // initialize all integers to 100 You can also partially initialize elements in an array, like this: int MyNumbers [5] = {34, 56}; // initialize first two elements |
You can initialize the first few elements in an array to different values and following ones automatically to zero, like this: int MyNumbers [5] = {34, 56}; // elements initialize 34, 56, 0, 0, 0 Thus, you can also initialize all elements in an array to zero, like this: int MyNumbers [5] = {0}; |
4/2/2013 |
2 | p61 | When asked to access element at index N, the compiler uses the memory address of the first element (positioned at index zero) as the starting point and then skips N elements by adding the offset computed as N*sizeof(element) to reach the address containing the (N+1)th element. | When asked to access element at index N, the compiler uses the memory address of the first element (positioned at index zero) as the starting point and then skips N elements by adding the offset computed as N*sizeof(element) to reach the address containing the (N+1)th element. | 4/2/2013 |
2 | p64 | Output | Analysis | 4/2/2013 |
2 | p87 | The program displays the binary result of the various operations. Interesting is to note the output in the event the two supplied integers are the same. The operators ==, >=, and <= produce identical results. | The program displays the binary result of the various operations. Note that when the two integers entered are identical, as demonstrated by the second run, operators ==, >=, and <= produce an identical result, returning 1. | 4/2/2013 |
2 | p117 | Yet, the switch-case version looks a little more structured and is possibly well-suited to situations where you want to be doing more that just writing a line to the screen (in which case you would also include code within a case within braces, creating blocks). | Yet, the switch-case version looks a little more structured and is possibly well-suited to situations where you want to be doing more than just writing a line to the screen (in which case you would also include code within a case within braces, creating blocks). | 4/2/2013 |
2 | p128 | This is where continue and break can help you. | bad break fixed | 4/2/2013 |
2 | p132 | Listing 6.12 uses an empty for(;;) statement to create an infinite loop. You can replace that with while(true) or a do... while(true); to generate the same output using a different loop type. | bad break fixed | 4/2/2013 |
2 | p137 | The loop repeats with new values in Num1 and Num2 thanks to these three Linesif the user presses y to repeat. | The loop repeats with new values in Num1 and Num2 thanks to these three linesif the user presses y to repeat. | 4/2/2013 |
2 | p138 | Q How do I exit an infinite loop? A Use break to exit the loop. Using return exits the function module, too. |
Delete question and answer. | 4/2/2013 |
2 | p141 | The larger and more complex your program gets, the longer the contents of main() become, unless you choose to structure your program using functions. | The larger and more complex your program gets, the longer the contents of main() becomes, unless you choose to structure your program using functions. | 4/2/2013 |
2 | p161 | lambda functions are discussed in depth in Lesson 22, C++11 Lambda Expressions. | Lambda functions are discussed in depth in Lesson 22, C++11 Lambda Expressions. | 4/2/2013 |
2 | p170 | The answer lies in using the de-referencing operator (*). | bad break fixed | 4/2/2013 |
2 | p175 | You use new to allocate new memory blocks. | You use new to allocate new memory blocks. (extra space) | 4/2/2013 |
2 | p180 | 20: for(int Index = 0, int* pCopy = pNumbers; Index < InputNums; ++Index) | 20: for(int Index = 0; Index < InputNums; ++Index) | 4/2/2013 |
2 | p187 | When you dereference a pointer using operator (*) to access the pointed value, you need to be 100% sure that the pointer contains a valid memory location, else your program will either crash or misbehave. | When you dereference a pointer using operator (*) to access the pointed value, you need to be 100% sure that the pointer contains a valid memory location, else your program will either crash or misbehave. | 4/2/2013 |
2 | p200 | 2:_*pNum1 = 20; | 2: *pNum1 = 20; | 4/2/2013 |
2 | p213 | A constructor is always invoked when an object is created. | A constructor is always invoked when an object is created. (extra space) |
4/2/2013 |
2 | p215 | As constructors can be overloaded just like functions, we can create a constructor that requires Human to be created with a name as a parameter, for instance: | As constructors can be overloaded just like functions, we can create a constructor that requires Human to be created with a name as a parameter, for instance: (extra space) |
4/2/2013 |
2 | p220 | Human Eve(Eve, 18); // Eve.Age is assigned 18 as specified | Human Eve(Eve, 18); // Eve.Age is assigned 18 as specified | 4/2/2013 |
2 | p221 | You can see class Human that features a default constructor with parameters with default values and an initialization list in Listing 9.6. | You can see class Human that features a default constructor with parameters with default values and an initialization list in Listing 9.6. (wrong space font) |
4/2/2013 |
2 | p253 | This is illustrated in Figure 10.2 | This is illustrated in Figure 10.2. | 4/2/2013 |
2 | p263 | If you want to be invoke Fish::Swim() in Listing 10.4 via main(), you need to use the scope resolution operator (::) in the following syntax: | If you want to invoke Fish::Swim() in Listing 10.4 via main(), you need to use the scope resolution operator (::) in the following syntax: | 4/2/2013 |
2 | p270 | main() as shown in Lines 6770 is spectacularly small for the volume of output it generates. | main() as shown in Lines 6770 is spectacularly small for the volume of output it generates. (extra space) |
4/2/2013 |
2 | p277 | Earlier in this chapter I mentioned that in some certain cases multiple inheritance might be relevant, such as with the platypus. | Earlier in this lesson, I mentioned that in some certain cases multiple inheritance might be relevant, such as with the platypus. | 4/2/2013 |
2 | p292 | Function MakeFishSwim(Fish&) in Listing11.2 ends up invoking Carp::Swim() or Tuna::Swim() methods in spite of the programmer calling Fish::Swim()within it. | Function MakeFishSwim(Fish&) in Listing 11.2 ends up invoking Carp::Swim() or Tuna::Swim() methods in spite of the programmer calling Fish::Swim()within it. | 4/2/2013 |
2 | p313 | As the name suggests, operators that function on a single operand are called unary operators. | As the name suggests, operators that function on a single operand are called unary operators. | 4/2/2013 |
2 | p321 | 4/2/2013 | ||
2 | p338 | The operator that allow array-style [] access to a class is called subscript operator. | The operator that allows array-style [] access to a class is called subscript operator. | 4/2/2013 |
2 | p342 | Listing 12.11 | Not the right font...fixed | 4/2/2013 |
2 | p364 | Q I need a Bird*, but have a Dog* at hand. The compiler does not allow me to use the pointer to the Dog object as a Bird*. However, when I use reinterpret_cast to cast the Dog* to Bird*, the compiler does not complain and it seems I can use this pointer to call Birds member function, Fly(). Is this okay? | bad break fixed | 4/2/2013 |
2 | p377 | If you need the ability to program generic functions that are type independent, yet type safe, you program a template function instead of a macro function. If you need to boost performance, you call that function inline. $I~macro functions;advantages of> You have already been introduced to programming inline functions using keyword inline in Listing 7.10 in Lesson 7, Organizing Code with Functions. |
If you need the ability to program generic functions that are type independent, yet type safe, you program a template function instead of a macro function. If you need to boost performance, you call that function inline. You have already been introduced to programming inline functions using keyword inline in Listing 7.10 in Lesson 7, Organizing Code with Functions. |
4/2/2013 |
2 | p381 | This sample features two template functions: GetMax() in Lines 4 to 11, which is used by DisplayComparison() in Lines 13 to 18. main() demonstrates in Lines 23, 26, and 29 how the same template function has been reused for very different data types: integer, double, and std::string. | bad break fixed | 4/2/2013 |
2 | p395 | A new noted added to end of page. To make room for it, page 394 was also adjusted. | NOTE: Complexity in a Nutshell Constant time complexity means that the size of the container has no influence on the performance of the same, that is performance remains unchanged even if the container were to have 10,000 elements instead of 100. Often represented mathematically as O(1). Linear complexity means that the performance of an operation deteriorates in direct proportion to the number of elements it is being performed upon. For instance, std::find on an unsorted container such as std::vector can be expected to be 100 times as slow if the container were to contain 10,000 elements instead of 100. Often represented mathematically as O(N). Logarithmic complexity means that the performance of an operation (such as finding an element) deteriorates in direct proportion to the LOG of the number of elements it is being performed upon. For instance, std::map::find can be expected to be only twice as slow if the container were to contain 10,000 elements instead of 100. Often represented mathematically as O(log N). |
4/2/2013 |
2 | p398 | These containers are discussed in detail in Lesson 24, Adaptive Containers: Stack and Queue. | These containers are discussed in detail in Lesson 24, Adaptive Containers: Stack and Queue. | 4/2/2013 |
2 | p399 | Note that operations could as well be STL algorithms that are template functions, Iterators are the bridge that allows these template functions to work with containers, which are template classes, in a consistent and seamless manner. | Note that operations could as well be STL algorithms that are template functions. Iterators are the bridge that allows these template functions to work with containers, which are template classes, in a consistent and seamless manner. | 4/2/2013 |
2 | p400 | Finding, sorting, reversing, and the like are standard programming requirements that should not require the programmer to reinvent implementation to support. | Finding, sorting, reversing, and the like are standard programming requirements that should not require the programmer to reinvent implementation to support. (extra space) |
4/2/2013 |
2 | p402 | The algorithm distance is applied by computing the offset position of the element found. | bad break fixed | 4/2/2013 |
2 | p410 | Listing 16.2 Two Ways of Accessing Character Clements of an STL string::Operator[] and Iterators | Listing 16.2 Two Ways of Accessing Character Elements of an STL string::Operator[] and Iterators | 4/4/2013 |
2 | p424 | A vector is a template class that needs to be instantiated in accordance with template instantiation techniques that are covered in Lesson 14, An introduction to Macros and Templates. | A vector is a template class that needs to be instantiated in accordance with template instantiation techniques that are covered in Lesson 14, An Introduction to Macros and Templates. | 4/4/2013 |
2 | p425 | Listing 17.1 demonstrates a few vector instantiations | Listing 17.1 demonstrates a few vector instantiations. | 4/4/2013 |
2 | p438 | The deque is quite similar to the vector in that it supports element insertions and deletions at the back via the push_back() and pop_back() methods. |
The space before deque is the wrong font. Fixed. | 4/4/2013 |
2 | p441 | Q What function gets the number of elements stored in a vector? | The word vector is the wrong font. Fixed. | 4/4/2013 |
2 | p442 | A No, the properties of the deque are similar to that of the vector when it comes to insertion, which is a constant-time activity for elements added at the end of sequence and a linear-time activity for elements inserted in the middle. | The space before deque is the wrong font. Fixed. | 4/4/2013 |
2 | p447 | 14: list<int> listWith4IntegerEach99 (10, 99); | 14: list<int> listWith4IntegerEach99 (4, 99); | 4/4/2013 |
2 | p67 | The element with value 456 is at position [2][2]. | The element with value 456 is at position [2][1]. | 4/10/2013 |
2 | p472 | Lines 413 contain the generic template function DisplayContents(), which you have also seen in Lesson 17, TL Dynamic Array Classes, and 18, STL list and forward_list, and writes the contents of an STL container to the console or screen. |
Lines 413 contain the generic template function DisplayContents(), which you have also seen in Lesson 17, STL Dynamic Array Classes, and 18, STL list and forward_list, and writes the contents of an STL container to the console or screen. |
4/10/2013 |
2 | p503 | This topic is addressed in further detail in Lesson 21, Understanding Function Objects. | This topic is addressed in further detail in Lesson 21, Understanding Function Objects. | 4/10/2013 |
2 | p503 | The std::map is well suited for storing key-value pairs where you can look up a value given a key. map does guarantee better performance than an STL vector or list when it comes to searching. Yet, it does slow down when the number of elements increases. The operational performance of a map is said to be logarithmic in naturethat is, proportional to the LOG of the number of elements placed in the map. In simple words, a logarithmic complexity means that a container such as std::map or std::set is twice as slow for 10,000 elements as it is for 100. An unsorted vector presents linear complexity when it comes to search, which means that it is a 100 times slower for 10,000 elements as it is for 100. |
The std::map is well suited for storing key-value pairs where you can look up a value given a key. map does guarantee better performance than an STL vector or list when it comes to searching. It does slow down as the number of elements increases, but not in direct proportion. The operational performance of a map is said to be logarithmic in naturethat is, proportional to the LOG of the number of elements placed in the map. This is better than linear complexity that implies a reduction in performance in direct proportion to the number of elements in the container (as in an unsorted vector). |
4/10/2013 |
2 | p521 | In this sample, you use the algorithm std::transform to multiple the content of two ranges and store in a third. | In this sample, you use the algorithm std::transform to multiply the content of two ranges and store in a third. | 4/10/2013 |
2 | p529, 531, 533, 535, 537, 539, 541 | All thumbtabs for Hour 22 say E and are in the wrong place. | fixed | 4/10/2013 |
2 | p531 | For example, the following is a lambda expression that returns true for even numbers: |
For example, the following is a lambda expression that returns true for even numbers: |
4/10/2013 |
2 | p555 | Listing 23.4 uses the fill() and fill_n() functions to initialize the contents of the container to two separate sets of values, as shown in Lines 12 and 18. Note the usage of the resize() function before you filled values into the range, essentially creating elements that were later filled with values. The fill() algorithm works on a complete range, whereas fill_n() has the potential to work on a partial range. |
Listing 23.4 uses the fill() and fill_n() functions to initialize the contents of the container to two separate sets of values, as shown in Lines 12 and 18. Note the usage of the resize() function before you filled values into the range, essentially creating elements that were later filled with values. |
4/10/2013 |
2 | p608 | Given the problems with using conventional pointer and conventional memory management techniques, it should be noted that the C++ programmer is not forced to use them when he needs to manage data on the heap/free store. | Given the problems with using conventional pointer and conventional memory management techniques, it should be noted that the C++ programmer is not forced to use them when he needs to manage data on the heap/free store. | 4/10/2013 |
2 | p618 | Its pretty apparent that the version of the smart pointer shipped with the C++ Standard Library is not going to meet every programmers requirements. | Its pretty apparent that the version of the smart pointer shipped with the C++ Standard Library is not going to meet every programmers requirements. | 4/10/2013 |
2 | p632 | getline() as shown in Line 8 did the job of ensuring that white space characters are not skipped. | getline() as shown in Line 8 did the job of ensuring that whitespace characters are not skipped. | 4/10/2013 |
2 | p640 | DONT forget that function getline(cin, strData); fetches you an entire line from the input stream, including white spaces. | DONT forget that function getline(cin, strData); fetches you an entire line from the input stream, including whitespaces. | 4/10/2013 |
2 | p640 | A cin.getline() ensures that you capture the entire line including white spaces entered by the user. cin.get()helps you capture user input one character at a time. | A cin.getline() ensures that you capture the entire line including whitespaces entered by the user. cin.get()helps you capture user input one character at a time. | 4/10/2013 |
2 | p644 | Some complains will be about an Access Violation, whereas some others will quote an Unhandled Exception. | Some complaints will be about an Access Violation, whereas some others will quote an Unhandled Exception. | 4/10/2013 |
2 | p655 | DONT take memory allocations for granted; code that does new should always be exception safe and within a try block with a catch(std::exception& ). |
DONT take memory allocations for granted; code that does new should always be exception safe and within a try block with a catch(std::exception&). |
4/10/2013 |
2 | p656 | 3. Is it alright to allocate a million integers in an exception handler (catch block) to back up existing data for instance? | 3. Is it all right to allocate a million integers in an exception handler (catch block) to back up existing data for instance? | 4/10/2013 |
2 | p665 | When using arrays, never cross the bounds of the array buffer. This is called a buffer overflow and can exploited as a security vulnerability. |
When using arrays, never cross the bounds of the array buffer. This is called a buffer overflow and can be exploited as a security vulnerability. |
4/10/2013 |
2 | p673 | Eight bits in a byte also allows the transmission of up to 28 different values, allowing for 255 distinct values. | Eight bits in a byte also allows the transmission of up to 28 different values, allowing for 255 distinct values. (superscript 8 wrong font size) |
4/10/2013 |
2 | p674 | It is convention that hexadecimal numbers be represented with a prefix 0x. | It is convention that hexadecimal numbers be represented with a prefix 0x. | 4/10/2013 |
2 | p693 | 4. Note how Pi has not been exposed outside the class as required: | 4. Note how Pi has not been exposed outside the class as required: | 4/10/2013 |
2 | p707 | 1. This is like Exercise solution 1 for the vector in Lesson 17, Dynamic Array Classes. | 1. This is like Exercise solution 1 for the vector in Lesson 17, STL Dynamic Array Classes. | 4/10/2013 |