{"id":2915,"date":"2022-09-18T11:11:50","date_gmt":"2022-09-18T05:41:50","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=2915"},"modified":"2022-09-18T11:11:50","modified_gmt":"2022-09-18T05:41:50","slug":"book-review-embracing-modern-c-safely","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2022\/09\/18\/book-review-embracing-modern-c-safely\/","title":{"rendered":"Book Review: Embracing Modern C++ Safely"},"content":{"rendered":"<p><span style=\"color: #0000ff;\"><em><strong>Title:<\/strong> <\/em><\/span>Embracing Modern C++ Safely<br \/>\n<span style=\"color: #0000ff;\"><em><strong>Authors:<\/strong> <\/em><\/span>John Laos, Vittorio Romeo, Rostislav Khlebnikov, and Alisdair Meredith<br \/>\n<span style=\"color: #0000ff;\"><em><strong>Publisher:<\/strong><\/em><\/span> Pearson Education, Inc.<br \/>\n<span style=\"color: #0000ff;\"><em><strong>Year:<\/strong><\/em><\/span> 2022<\/p>\n<p><em><strong><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/09\/Book2-scaled.jpg?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"2917\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2022\/09\/18\/book-review-embracing-modern-c-safely\/book2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/09\/Book2-scaled.jpg\" data-orig-size=\"2008,2560\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;1.8&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone X&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1663498926&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4&quot;,&quot;iso&quot;:&quot;64&quot;,&quot;shutter_speed&quot;:&quot;0.058823529411765&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/09\/Book2-803x1024.jpg\" class=\"size-medium wp-image-2917 alignleft\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/09\/Book2.jpg?resize=235%2C300&#038;ssl=1\" alt=\"\" width=\"235\" height=\"300\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/09\/Book2-scaled.jpg?resize=235%2C300&amp;ssl=1 235w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/09\/Book2-scaled.jpg?resize=803%2C1024&amp;ssl=1 803w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/09\/Book2-scaled.jpg?resize=768%2C979&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/09\/Book2-scaled.jpg?resize=1205%2C1536&amp;ssl=1 1205w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/09\/Book2-scaled.jpg?resize=1606%2C2048&amp;ssl=1 1606w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/09\/Book2-scaled.jpg?w=2008&amp;ssl=1 2008w\" sizes=\"(max-width: 235px) 100vw, 235px\" \/><\/a><\/strong><\/em><\/p>\n<p><em><strong>C++<\/strong><\/em> is a complex language. Fortunately, we have several good books (and other online material) for programmers at various levels. A few weeks ago, I had reviewed and recommended <a href=\"https:\/\/www.rangakrish.com\/index.php\/2022\/07\/11\/book-review-beautiful-c-30-core-guidelines-for-writing-clean-safe-and-fast-code\/\" target=\"_blank\" rel=\"noopener\"><em><strong>\u201cBeautiful C++\u201d<\/strong><\/em><\/a>, book suitable for intermediate to advanced programmers. Today, I am thrilled to write about another excellent book that is targeted at advanced programmers.<\/p>\n<p>What makes this book special is that its focus is on <em><strong>\u201csafety\u201d<\/strong><\/em> in the context of <em><strong>C++<\/strong><\/em> language features. According to the authors, <em><strong>\u201csafe\u201d<\/strong><\/em> features are those that <em><strong>\u201cadd considerable value, are easy to use, and are decidedly hard to misuse unintentionally\u201d<\/strong><\/em>. They additionally introduce two variants of safety: <em><strong>\u201cconditionally safe\u201d<\/strong><\/em> and <em><strong>\u201cunsafe\u201d<\/strong><\/em>. Conditionally safe features have some inherent limitations and hence in order to use them correctly, programmers require adequate training and extra care. Unsafe features are those that can be counterproductive in a large-scale project when used routinely. Exploring <em><strong>C++<\/strong><\/em> from the perspective of <em><strong>\u201csafety\u201d<\/strong><\/em> reveals many interesting practical aspects of the language and writing an entire book on this theme is a challenging task indeed.<\/p>\n<p>The book contains three main chapters, corresponding respectively to the categories of safety introduced above:<\/p>\n<p style=\"padding-left: 40px;\"><strong>Chapter 1: Safe Features<\/strong><br \/>\n<strong>Chapter 2: Conditionally Safe Features<\/strong><br \/>\n<strong>Chapter 3: Unsafe Features<\/strong><\/p>\n<p>Each chapter includes features from <em><strong>C++ 11<\/strong><\/em> and <em><strong>C++ 14<\/strong><\/em>. While explaining each feature, the authors follow a structured format, covering its syntax and semantics with several non-trivial examples, potential pitfalls, annoyances, and pointers to further reading.<\/p>\n<p>I do not want to spoil the excitement by revealing the list of features discussed in the book. So, let me mention just one feature from each of the three categories:<br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1) Safe feature =&gt; \u201coverride\u201d member function qualifier<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2) Conditionally safe feature =&gt; \u201cnoexcept\u201d operator<\/span><br \/>\n<span style=\"color: #0000ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3) Unsafe feature =&gt; \u201cfinal\u201d member function qualifier<\/span><\/p>\n<p>For anyone who has been programming in <em><strong>C++<\/strong><\/em> for a few years, these might come as a bit of a surprise, but believe me, when you go through the explanation given in the book, you will definitely appreciate why the authors have classified a feature the way they have done!<\/p>\n<p>The authors have to be congratulated for presenting the material very objectively, based on <em><strong>\u201cfacts and not opinions\u201d<\/strong><\/em>. This is very important because the book is not about <em><strong>\u201cguidelines\u201d<\/strong><\/em>. Also, the authors do not just skim over each feature, but explain it thoroughly. The presentation assumes that the reader has a good grasp of <em><strong>C++<\/strong><\/em>, and so this book will not appeal to beginners. The authors are highly experienced <em><strong>C++<\/strong><\/em> programmers and naturally, reading the book (almost an encyclopaedia with over 1300 pages) is very rewarding experience (although occasionally intimidating!)<\/p>\n<p>My only disappointment is that such a great book stops with <em><strong>C++ 14<\/strong><\/em>. Of course, the authors adequately justify why this is so and I am with them. Developers are already using <em><strong>C++ 17<\/strong><\/em> and <em><strong>C++ 20<\/strong><\/em> features and a book of this nature will benefit them immensely. I fondly hope that the authors come out with an updated edition in a year or two, which covers the more recent standards.<\/p>\n<p>Have a nice week!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Title: Embracing Modern C++ Safely Authors: John Laos, Vittorio Romeo, Rostislav Khlebnikov, and Alisdair Meredith Publisher: Pearson Education, Inc. Year: 2022 C++ is a complex language. Fortunately, we have several good books (and other online material) for programmers at various levels. A few weeks ago, I had reviewed and recommended \u201cBeautiful C++\u201d, book suitable for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[94,49],"tags":[67,144,50,335],"class_list":["post-2915","post","type-post","status-publish","format-standard","hentry","category-book-review","category-c","tag-c","tag-c11","tag-c14","tag-safe-features"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-L1","jetpack-related-posts":[{"id":2868,"url":"https:\/\/www.rangakrish.com\/index.php\/2022\/07\/11\/book-review-beautiful-c-30-core-guidelines-for-writing-clean-safe-and-fast-code\/","url_meta":{"origin":2915,"position":0},"title":"Book Review &#8211;  Beautiful C++: 30 Core Guidelines for Writing Clean, Safe, and Fast Code","author":"admin","date":"July 11, 2022","format":false,"excerpt":"Title: Beautiful C++: 30 Core Guidelines for Writing Clean, Safe, and Fast Code Authors: J.Guy Davidson, Kate Gregory Publisher:\u00a0 Pearson Education Year: 2022 My earliest introduction to C++ guidelines was through Scott Meyers\u2019 excellent book Effective C++ that first appeared in 1992. After programming in C++ for around 3 years\u2026","rel":"","context":"In &quot;Book Review&quot;","block_context":{"text":"Book Review","link":"https:\/\/www.rangakrish.com\/index.php\/category\/book-review\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/07\/Book-Cover2-233x300.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":988,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/07\/22\/book-review-design-patterns-in-modern-c\/","url_meta":{"origin":2915,"position":1},"title":"Book Review &#8211; Design Patterns in Modern C++","author":"admin","date":"July 22, 2018","format":false,"excerpt":"Title: Design Patterns in Modern C++ - Reusable Approaches for Object-Oriented Software Design Author: Dmitri Nesteruk Publisher: Apress Year: 2018 Luck has been on my side for the past few weeks; I have been getting access to nice books to read. I wrote about The\u00a0Modern C++ Challenge in my last\u2026","rel":"","context":"In &quot;Book Review&quot;","block_context":{"text":"Book Review","link":"https:\/\/www.rangakrish.com\/index.php\/category\/book-review\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":980,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/07\/08\/book-review-the-modern-c-challenge\/","url_meta":{"origin":2915,"position":2},"title":"Book Review &#8211; The Modern C++ Challenge","author":"admin","date":"July 8, 2018","format":false,"excerpt":"Title: The Modern C++ Challenge Author: Marius Bancilla Publisher: Packt Publishing Year: May 2018\u00a0 This week I have been going through a new book titled The Modern C++ Challenge written by Marius Bancilla. The book is a collection of programming problems (along with suggested solutions) targeting C++ . The title\u2026","rel":"","context":"In &quot;Book Review&quot;","block_context":{"text":"Book Review","link":"https:\/\/www.rangakrish.com\/index.php\/category\/book-review\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3249,"url":"https:\/\/www.rangakrish.com\/index.php\/2023\/11\/06\/book-review-c-initialization-story\/","url_meta":{"origin":2915,"position":3},"title":"Book Review: C++ Initialization Story","author":"admin","date":"November 6, 2023","format":false,"excerpt":"Title: C++ Initialization Story - A Guide Through All Initialization Options and Related C++ Areas Author: Bart\u0142omiej Filipek Publisher: Leanpub Year: 2023 Can you believe that there is a language where \u201cinitialization\u201d itself involves many subtleties and a whole book can be devoted to this topic? Yes, modern C++ is\u2026","rel":"","context":"In &quot;Book Review&quot;","block_context":{"text":"Book Review","link":"https:\/\/www.rangakrish.com\/index.php\/category\/book-review\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/11\/Book-cover-231x300.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1278,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/12\/02\/book-review-functional-programming-in-c\/","url_meta":{"origin":2915,"position":4},"title":"Book Review: Functional Programming in C++","author":"admin","date":"December 2, 2018","format":false,"excerpt":"Title: Functional Programming in C++: How to improve your C++ programs using functional techniques Author: Ivan Cukic Publisher: Manning Publications Co. Year: 2019 This book came out recently, about a week ago. I bought it immediately, and when I started to read it, I couldn\u2019t put it down! Very informative\u2026","rel":"","context":"In &quot;Book Review&quot;","block_context":{"text":"Book Review","link":"https:\/\/www.rangakrish.com\/index.php\/category\/book-review\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1496,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/03\/10\/book-review-c-concurrency-in-action\/","url_meta":{"origin":2915,"position":5},"title":"Book Review: C++ Concurrency in Action","author":"admin","date":"March 10, 2019","format":false,"excerpt":"Title: C++ Concurrency in Action Author: Anthony Williams Publisher: Manning Publications Co. Year: 2019 (Second Edition) \u00a0 The first edition of this book came out in the year 2012 and covered the concurrency features of C++ 11. Much has happened since then. The present C++17 is significantly richer in terms\u2026","rel":"","context":"In &quot;Book Review&quot;","block_context":{"text":"Book Review","link":"https:\/\/www.rangakrish.com\/index.php\/category\/book-review\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/2915","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=2915"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/2915\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=2915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=2915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=2915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}