Available as ebook at Leanpub: leanpub/cppinitbook
Initialization in C++ is a hot topic! The internet is full of discussions about best practices, and there are even funny memes on that subject. The situation is not surprising, as there are more than a dozen ways to initialize a simple integer value, complex rules for the auto-type deduction, data members, and object lifetime nuances.
And here comes the book.
Throughout this text, you will learn practical options to initialize various categories of variables and data members in Modern C++. More specifically, this text teaches multiple types of initialization, constructors, non-static data member initialization, inline variables, designated initializers, and more. Additionally, you’ll see the changes and new techniques from C++11 to C++20 and lots of examples to round out your understanding.
The plan is to explain most (if not all) parts of initialization, learn lots of excellent C++ techniques, and see what happens under the hood.
Bartłomiej (Bartek) Filipek is a C++ software developer with more than 14 years of professional experience. In 2010 he graduated from Jagiellonian University in Cracow, Poland with a Masters Degree in Computer Science.
Bartek currently works at Xara (http://www.xara.com/), where he develops features for advanced document editors. He also has experience with desktop graphics applications, game development, large-scale systems for aviation, writing graphics drivers and even biofeedback. In the past, Bartek has also taught programming (mostly game and graphics programming courses) at local universities in Cracow.
Since October 2018, Bartek has been a C++ Expert for the Polish National Body which works directly with ISO/IEC JTC 1/SC 22 (C++ Standardisation Committee). In the same month, Bartek was awarded his first MVP title for the years 2019/2020 by Microsoft.
In his spare time, he loves collecting and assembling Lego models with his little son.
In this book, Bartłomiej provides his usual introduction followed by comprehensive coverage of a very important topic within the vast framework that is Modern C++. Initialization is a highly complex topic that unfortunately only gets superficial coverage in other books, although it is perhaps one of the most important areas of C++. Developers must come to grips with the many types and side-effects of the choice of initialization, in order to write correct, well-defined, and efficient C++ code.
Over the years, the various Standards have made many changes to how initialization is handled and it has become an onerous task to keep up with all of these as C++ evolves. This combined with the fact that the Standard has now grown to some 1834 pages of "standardese" wording, as of C++20, and it quite understandable why many developers shy away from it, visiting it infrequently and only as a last resort.
The growth of complexity of modern day programming languages is one of the reasons for Stack Overflow's growth to such a large community, with answers to millions of questions. Although StackO verflow provides a good place for targeted answers to well defined tactical questions, one must still know what questions to ask and how to strategically write the code to solve a problem they are presented with.
Well written comprehensive books like the "C++ Initialization Story" provide a good opportunity for developers of all skill levels to thoroughly study this important aspect of C++ development. Bartłomiej does an excellent job of taking a very diverse topic and presenting it with plenty of examples and text that is both interesting to read and easy to comprehend. The ordering of the chapters of the book has been very well thought out and provides a great path through the topic, from fundamental ideas every developer should know, to more tangential areas leaving one with thoughts ranging from, "I didn't know this behavior changed in one of the newer Standards", to frequent bouts of, "I have to write this down, because this is the most complete and concise discussion of topic 'XYZ' that I have come across to date."
Additionally, very many code examples are in included in the book to illustrate the topics being discussed, as they apply to practical use in one's code. These are often combined with links to the Compiler Explorer web site, allowing one to modify the code in an "I wonder what would happen if..." manner, in order to truly understand why it behaves the way it does. This provides a hands on opportunity to truly cement the information that is presented in the text through the act of actual hands-on practice.
As was the case with his other books, Bartłomiej shows a great talent for elucidating on a complex topic without resorting to the seemingly difficult to read "legalese" language that pervades the majority of the C++ Standard documents. In my opinion, he provides an opportunity for a diligent developer to gain a very solid foundation of knowledge, not only on the topic being discussed, but many other topics of C++ that are associated or effected by Initialization.
When one completes this book, they certainly feel that they have learned far more than mere initialization rules. So many other intersecting and often ignored areas of C++ get visited along the way, that a C++ Developer of any skill level, from beginner to expert, would greatly benefit from a thorough front to back read-through of the material presented. As an added benefit, once completed, the book a great reference for revisiting the more complex topics and corner cases that are presented, as these occur over the course of one's daily problem solving and development tasks.
As far as I know, Bartłomiej is one of the best authors for C++! His books always provides very sensibly contents for real world and I think we couldn't find more better book!