From 7bf721c0efec1bec68261f31849208f68ec7009c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Mon, 6 Nov 2017 23:44:19 +0100 Subject: [PATCH 01/22] Create Errata --- Errata | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Errata diff --git a/Errata b/Errata new file mode 100644 index 0000000..47b30a5 --- /dev/null +++ b/Errata @@ -0,0 +1,35 @@ +This is not a final proposal. +I am currently studying chapter 03 , and here are the errata I have found so far. Contact the author and he will approve them. +(It is also a way for me to advertise my work as a proofreaded, something that I have done all ready for 2 linux books) + + + +Chapter 1 +page 12 +F5B9E1 as a decimal value is given by +15 × 165 + 5 × 164 + 11 × 163 + 9 × 162 + 14 × 161 + 1 × 160 +should be writen in a way to denote clearly the powers of 16, like : +15 × 16^5 + 5 × 16^4 + 11 × 16^3 + 9 × 16^2 + 14 × 16^1 + 1 × 16^0 + +Chapter 2 +page 28 binary literals +the declaration + int mask {0B11111111000000001111111100000000}; // 4 bytes +should be substituted with + unsigned int mask {0B11111111000000001111111100000000}; // 4 bytes + +Chapter 3 +page 69 Ex3_02.cpp +the line + std::cout << "Is today's value(" << static_cast(today) + << ") the same as poets_day(" << static_cast(poets_day) + << ")" << static_cast(ch) << std::endl; +should have in the middle the new variable:tomorrow, that was assigned with a copy of poets_day + << ") the same as poets_day(" << static_cast(tomorrow) + +page 70 +After the text : + For example, the Day enumeration could be defined like this: + enum class Day {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday}; +the correct is + enum Day {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday}; From cc998947a4a62e5d1e7d642bbcc191d1282b40f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Tue, 7 Nov 2017 23:49:08 +0100 Subject: [PATCH 02/22] Update Errata --- Errata | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Errata b/Errata index 47b30a5..dd91873 100644 --- a/Errata +++ b/Errata @@ -33,3 +33,9 @@ After the text : enum class Day {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday}; the correct is enum Day {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday}; + +page 73 Ex3_03.cpp +the 5th line of main is + std::cout << "Value of global count2 = " << count1 << std::endl; +the correct is + std::cout << "Value of global count2 = " << count2 << std::endl; From e652f7b06324fbb13033202736d5ac6e2b250c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sun, 12 Nov 2017 14:15:30 +0100 Subject: [PATCH 03/22] Update Errata --- Errata | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Errata b/Errata index dd91873..35bbf2a 100644 --- a/Errata +++ b/Errata @@ -39,3 +39,11 @@ the 5th line of main is std::cout << "Value of global count2 = " << count1 << std::endl; the correct is std::cout << "Value of global count2 = " << count2 << std::endl; + +Chaoter 4 +page 102 Exercises + Exercise 4-1. Write a program that prompts for two integers to be entered and then uses an + if-else statement to output a message that states whether or not the integers are the same. +The correct text should be (according to the solution provided in this github) + Exercise 4-1. Write a program that prompts for two integers to be entered and then uses an + if-else statement to output a message that states whether or not the 1st integer is exactly divided by the 2nd. From e4d50d445e0ee84c78d380efbbc397a25ef2c2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sun, 12 Nov 2017 14:15:49 +0100 Subject: [PATCH 04/22] Update Errata --- Errata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Errata b/Errata index 35bbf2a..c254fe9 100644 --- a/Errata +++ b/Errata @@ -40,7 +40,7 @@ the 5th line of main is the correct is std::cout << "Value of global count2 = " << count2 << std::endl; -Chaoter 4 +Chapter 4 page 102 Exercises Exercise 4-1. Write a program that prompts for two integers to be entered and then uses an if-else statement to output a message that states whether or not the integers are the same. From bc4dfe6fa4d958faba3452c761ea1f7ba8f35bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sun, 12 Nov 2017 14:16:40 +0100 Subject: [PATCH 05/22] Update Errata --- Errata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Errata b/Errata index c254fe9..2c86887 100644 --- a/Errata +++ b/Errata @@ -45,5 +45,5 @@ page 102 Exercises Exercise 4-1. Write a program that prompts for two integers to be entered and then uses an if-else statement to output a message that states whether or not the integers are the same. The correct text should be (according to the solution provided in this github) - Exercise 4-1. Write a program that prompts for two integers to be entered and then uses an + Exercise 4-1. Write a program that prompts for two positive integers to be entered and then uses an if-else statement to output a message that states whether or not the 1st integer is exactly divided by the 2nd. From f2a31c3307bcfc2df68fc8d01785f194a7531625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Fri, 17 Nov 2017 18:11:13 +0100 Subject: [PATCH 06/22] Update Errata --- Errata | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Errata b/Errata index 2c86887..f6e8d74 100644 --- a/Errata +++ b/Errata @@ -47,3 +47,11 @@ page 102 Exercises The correct text should be (according to the solution provided in this github) Exercise 4-1. Write a program that prompts for two positive integers to be entered and then uses an if-else statement to output a message that states whether or not the 1st integer is exactly divided by the 2nd. + + +Chapter 5 +page 141 +The sentence : "The function is a member of the class type, array, +of the object all array objects will have a fill() member, as well as other members." +should be substituted by : "The function is a member of the class type, array, +of the object. All array objects will have a fill() member, as well as other members." From 961b6d2879f7c4f346c36faa7cfa3e6036db1e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Fri, 17 Nov 2017 18:11:44 +0100 Subject: [PATCH 07/22] Rename Errata to Errata_by_GeorgiosDoumas --- Errata => Errata_by_GeorgiosDoumas | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Errata => Errata_by_GeorgiosDoumas (100%) diff --git a/Errata b/Errata_by_GeorgiosDoumas similarity index 100% rename from Errata rename to Errata_by_GeorgiosDoumas From 049e0b5567676ac56e040496f30bebb879b74370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sat, 18 Nov 2017 23:10:00 +0100 Subject: [PATCH 08/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index f6e8d74..e7ce9e8 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -55,3 +55,10 @@ The sentence : "The function is a member of the class type, array, of the object all array objects will have a fill() member, as well as other members." should be substituted by : "The function is a member of the class type, array, of the object. All array objects will have a fill() member, as well as other members." + +Chapter 6 +page 160 +The sentence near the top of the page: "If Arnie was an option instead +of Fatty, the minimum array dimension would need to accommodate the string “Arnold Schwarzenegger”, which +requires 21 bytes." +should have the following end: " ... which requires 22 bytes." , because we need one extra byte for the \0 From 0c3d66a895ee96c16767aa5477e465df1e8c528a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sun, 19 Nov 2017 19:18:16 +0100 Subject: [PATCH 09/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index e7ce9e8..59d2a49 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -62,3 +62,18 @@ The sentence near the top of the page: "If Arnie was an option instead of Fatty, the minimum array dimension would need to accommodate the string “Arnold Schwarzenegger”, which requires 21 bytes." should have the following end: " ... which requires 22 bytes." , because we need one extra byte for the \0 + +page 169 Dynamic Allocation of Arrays +The initial sentences are confusing. Here is how they are now : +<< Assuming that you’ve already declared pstring, of type +“pointer to char,” you could allocate an array of type char in the free store by writing the following: +double* pdata {new double[20]}; // Allocate 100 double values >> +But the writer must decide if he wants to talk about a char array pstring or a double array pdata. +And also take in account that, as shown on the bottom of page 168, it is not needed to declare in a seperate step the pointer +A possible chabge could be to drop the initial "Assuming ... , " and have either : +<> + or : +<> +Please contact the author to check this serious issue. From bb3f3743674783bba0444dfaaaf9ce792355bf3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sun, 19 Nov 2017 19:18:55 +0100 Subject: [PATCH 10/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index 59d2a49..7da0f4b 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -1,9 +1,7 @@ This is not a final proposal. -I am currently studying chapter 03 , and here are the errata I have found so far. Contact the author and he will approve them. +I am currently studying chapter 06 , and here are the errata I have found so far. Contact the author and he will approve them. (It is also a way for me to advertise my work as a proofreaded, something that I have done all ready for 2 linux books) - - Chapter 1 page 12 F5B9E1 as a decimal value is given by From a3856b9f4c21c4369526d31004efa812006c14a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sun, 19 Nov 2017 21:58:42 +0100 Subject: [PATCH 11/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index 7da0f4b..6874600 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -66,12 +66,12 @@ The initial sentences are confusing. Here is how they are now : << Assuming that you’ve already declared pstring, of type “pointer to char,” you could allocate an array of type char in the free store by writing the following: double* pdata {new double[20]}; // Allocate 100 double values >> -But the writer must decide if he wants to talk about a char array pstring or a double array pdata. +But the writer must decide if he wants to talk about a char array pstring or a double array pdata (100 or 20 elements?). And also take in account that, as shown on the bottom of page 168, it is not needed to declare in a seperate step the pointer A possible chabge could be to drop the initial "Assuming ... , " and have either : <> + *char pstring {new char[20]}; // Allocate 20 char values >> or : <> +double* pdata {new double[20]}; // Allocate 20 double values >> Please contact the author to check this serious issue. From a07bc07450460920687947f50b04d57614d64a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sun, 19 Nov 2017 21:59:03 +0100 Subject: [PATCH 12/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index 6874600..98667e0 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -1,6 +1,6 @@ This is not a final proposal. I am currently studying chapter 06 , and here are the errata I have found so far. Contact the author and he will approve them. -(It is also a way for me to advertise my work as a proofreaded, something that I have done all ready for 2 linux books) +(It is also a way for me to advertise my work as a proofreader, something that I have done all ready for 2 linux books) Chapter 1 page 12 From 698a2740cdcb2e94a7b343d19b6f03ac3ff339f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sun, 19 Nov 2017 23:41:40 +0100 Subject: [PATCH 13/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index 98667e0..8655878 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -75,3 +75,16 @@ A possible chabge could be to drop the initial "Assuming ... , " and have either <> Please contact the author to check this serious issue. + +page 171 Memory Leaks + Last sentence of the paragraph is: +"If a pointer contains the address of a block of memory in the free store goes out of +scope, then it’s no longer possible to delete the memory." + Should be substituted with : +"If a pointer, that contains the address of a block of memory in the free store, goes out of +scope, then it’s no longer possible to delete that memory." + Other possible ways to say the same thing: +"If a pointer contains the address of a block of memory in the free store and goes out of +scope, then it’s no longer possible to delete the memory." +"If a pointer containing the address of a block of memory in the free store goes out of +scope, then it’s no longer possible to delete the memory." From d75525041a1da9ef852e9985407b9f95ca9b2b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Mon, 20 Nov 2017 19:55:25 +0100 Subject: [PATCH 14/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index 8655878..46b7791 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -88,3 +88,9 @@ scope, then it’s no longer possible to delete that memory." scope, then it’s no longer possible to delete the memory." "If a pointer containing the address of a block of memory in the free store goes out of scope, then it’s no longer possible to delete the memory." + +page 174 +The line : +const size_t n {100}; // Array size +should be substituted with : +const size_t max {100}; // Array size From 58b1e202cb5e905cb161636caa135cb985945d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Mon, 20 Nov 2017 19:56:44 +0100 Subject: [PATCH 15/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index 46b7791..effd95b 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -90,7 +90,9 @@ scope, then it’s no longer possible to delete the memory." scope, then it’s no longer possible to delete the memory." page 174 -The line : +The lines : const size_t n {100}; // Array size -should be substituted with : +std::unique_ptr< double[]> pvalues {new double[n]} ; // Create array of n elements on the heap +should be substituted with (to be consistent with the following for-loops): const size_t max {100}; // Array size +std::unique_ptr< double[]> pvalues {new double[max]} ; // Create array of max elements on the heap From 4bd490cc7b45f464b147ee8f3ba6c171488f64ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Mon, 20 Nov 2017 20:07:05 +0100 Subject: [PATCH 16/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index effd95b..d2afc6d 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -96,3 +96,8 @@ std::unique_ptr< double[]> pvalues {new double[n]} ; // Create array of n elemen should be substituted with (to be consistent with the following for-loops): const size_t max {100}; // Array size std::unique_ptr< double[]> pvalues {new double[max]} ; // Create array of max elements on the heap + page 175 + The sentence : + "The result of executing this is that pdata will cease to point to anything." + should be substituted with : + "The result of executing this is that pvalue will cease to point to anything." From 4002beccaf37d385b4217467db9c51485c613669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Mon, 20 Nov 2017 22:54:48 +0100 Subject: [PATCH 17/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index d2afc6d..f13b2a1 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -96,8 +96,13 @@ std::unique_ptr< double[]> pvalues {new double[n]} ; // Create array of n elemen should be substituted with (to be consistent with the following for-loops): const size_t max {100}; // Array size std::unique_ptr< double[]> pvalues {new double[max]} ; // Create array of max elements on the heap - page 175 + +page 175 The sentence : - "The result of executing this is that pdata will cease to point to anything." +"The result of executing this is that pdata will cease to point to anything." should be substituted with : - "The result of executing this is that pvalue will cease to point to anything." +"The result of executing this is that pvalue will cease to point to anything." + +page 176 +std::cout << *pd << std::endl; // Outputs 999.0 (this is wrong) +std::cout << *pdata2 << std::endl; // Outputs 999.0 (this is the correct to appear in the book) From 9b5960993b2f216aeb09905a27c77a1c96feda6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sun, 26 Nov 2017 21:51:53 +0100 Subject: [PATCH 18/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index f13b2a1..1b5fb6e 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -9,6 +9,7 @@ F5B9E1 as a decimal value is given by should be writen in a way to denote clearly the powers of 16, like : 15 × 16^5 + 5 × 16^4 + 11 × 16^3 + 9 × 16^2 + 14 × 16^1 + 1 × 16^0 + Chapter 2 page 28 binary literals the declaration @@ -16,6 +17,7 @@ the declaration should be substituted with unsigned int mask {0B11111111000000001111111100000000}; // 4 bytes + Chapter 3 page 69 Ex3_02.cpp the line @@ -38,6 +40,7 @@ the 5th line of main is the correct is std::cout << "Value of global count2 = " << count2 << std::endl; + Chapter 4 page 102 Exercises Exercise 4-1. Write a program that prompts for two integers to be entered and then uses an @@ -106,3 +109,12 @@ page 175 page 176 std::cout << *pd << std::endl; // Outputs 999.0 (this is wrong) std::cout << *pdata2 << std::endl; // Outputs 999.0 (this is the correct to appear in the book) + + +Chapter 7 +page 186 +The line : string sleeping {6, 'z'}; +should be like this : string sleeping (6, 'z'); +Similarly instead of : string light_sleeper {1, 'z'}; +we should have : string light_sleeper (1, 'z'); + From 5fe5301c878b4f66e81a9a2cd83535a839f5f91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Mon, 27 Nov 2017 23:09:54 +0100 Subject: [PATCH 19/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index 1b5fb6e..0adb56e 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -118,3 +118,15 @@ should be like this : string sleeping (6, 'z'); Similarly instead of : string light_sleeper {1, 'z'}; we should have : string light_sleeper (1, 'z'); +page 197 +At the top of page , 1st code snippet is confusing and is followed by a sentence with a typing error: +if (!text.compare(i, 4, phrase, 7, 4)) + std::cout << "text contains " << phrase << " starting at index " << i << std::endl; +The above code should have a different output. Something like : +if (!text.compare(i, 4, phrase, 7, 4)) + std::cout << "text contains -pick- starting at index " << i << std::endl; +And the following sentence says : + The two additional arguments are the index position of the substring in phrase and its length. The substring of + text is compared with the substring of text. +The correct of course would be to say : + The substring of text is compared with the substring of phrase. From 84716d20b8ba6d2bb23e8b04bfea8db62d8c57bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Tue, 28 Nov 2017 23:44:50 +0100 Subject: [PATCH 20/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index 0adb56e..e1981c5 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -130,3 +130,11 @@ And the following sentence says : text is compared with the substring of text. The correct of course would be to say : The substring of text is compared with the substring of phrase. + + +Chapter 8 +page 224 +A very serious explanation error, just before the Note at the top of page: +"Passing a non-const argument for const function parameter will not compile." +The correct it the opposite, here is how it can be expressed in clear and unambigous language : +"Passing a const variable from the caller code block, as argument into a const function-parameter, will not compile." From 2f784b3c71ea90c324691dc38e154987cf7b5309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Wed, 29 Nov 2017 00:15:52 +0100 Subject: [PATCH 21/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index e1981c5..f9ed752 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -137,4 +137,4 @@ page 224 A very serious explanation error, just before the Note at the top of page: "Passing a non-const argument for const function parameter will not compile." The correct it the opposite, here is how it can be expressed in clear and unambigous language : -"Passing a const variable from the caller code block, as argument into a const function-parameter, will not compile." +"Passing a const variable from the caller code block, as argument into a non-const function-parameter, will not compile." From 4904b3846394ab78686c81769d43a1d8a08ee4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Doumas=20Georgios=20=28=CE=94=CE=BF=CF=8D=CE=BC=CE=B1?= =?UTF-8?q?=CF=82=20=CE=93=CE=B5=CF=8E=CF=81=CE=B3=CE=B9=CE=BF=CF=82=29?= Date: Sun, 3 Dec 2017 11:35:49 +0100 Subject: [PATCH 22/22] Update Errata_by_GeorgiosDoumas --- Errata_by_GeorgiosDoumas | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Errata_by_GeorgiosDoumas b/Errata_by_GeorgiosDoumas index f9ed752..fb3671b 100644 --- a/Errata_by_GeorgiosDoumas +++ b/Errata_by_GeorgiosDoumas @@ -135,6 +135,8 @@ The correct of course would be to say : Chapter 8 page 224 A very serious explanation error, just before the Note at the top of page: -"Passing a non-const argument for const function parameter will not compile." -The correct it the opposite, here is how it can be expressed in clear and unambigous language : -"Passing a const variable from the caller code block, as argument into a non-const function-parameter, will not compile." +"Passing a non-const argument for const function parameter will not compile." [NO! it will compile!] +The correct is the opposite, here is how it can be expressed in clear and unambigous language : +"Passing a const pointer variable from the caller code block, as argument for a non-const pointer function-parameter, +will not compile, because the compiler could not ensure that such a non-const pointer parameter is not altered in the +function body "