“Professional C++, 5th Edition” Released

After working on it for a year, I’m proud to announce my new book “Professional C++, 5th Edition” is finished 🙂

It has been updated to the C++20 standard and uses certain C++20 features, such as modules and std::format(), throughout all examples.

It is published by Wiley/Wrox, and available on Amazon.

Official Description

Improve your existing C++ competencies quickly and efficiently with this advanced volume

Professional C++, 5th Edition raises the bar for advanced programming manuals. Complete with a comprehensive overview of the new capabilities of C++20, each feature of the newly updated programming language is explained in detail and with examples. Case studies that include extensive, working code round out the already impressive educational material found within. 

Without a doubt, the new 5th Edition of Professional C++ is the leading resource for dedicated and knowledgeable professionals who desire to advance their skills and improve their abilities. This book contains resources to help readers: 

  • Maximize the capabilities of C++ with effective design solutions  
  • Master little-known elements of the language and learn what to avoid  
  • Adopt new workarounds and testing/debugging best practices  
  • Utilize real-world program segments in your own applications 

Notoriously complex and unforgiving, C++ requires its practitioners to remain abreast of the latest developments and advancements. Professional C++, 5th Edition ensures that its readers will do just that. 

Share

14 Comments so far »

  1. Raziel said,

    Wrote on February 28, 2021 @ 11:28 pm

    Hey, seems like there are a few errors in the book.
    Check this thread on reddit https://www.reddit.com/r/cpp/comments/ltwbsj/professional_c_5th_ed_and_statement_about_rvo_and/.

    Please correct that as soon as possible.

  2. Marc Gregoire said,

    Wrote on March 1, 2021 @ 7:57 pm

    Yes, there seems to be a slight miss-formulation in the RVO explanation. I will create an errata for it on the official Wiley/Wrox page for this book.

  3. Raziel said,

    Wrote on March 15, 2021 @ 2:20 pm

    There is an error with pointer conversion example. Every pointer can be converted to void* and back.
    reinterpret_cast when converting between unrelated types directly – however in order to use the result, (assuming that we point at valid object) what needs to use std::launder that is not mentioned in the book.

  4. Marc Gregoire said,

    Wrote on March 15, 2021 @ 6:40 pm

    Thank you Raziel.
    You are talking about the following code snippet:

    int main()
    {
    X x;
    Y y;
    X* xp { &x };
    Y* yp { &y };
    // Need reinterpret_cast for pointer conversion from unrelated classes
    // static_cast doesn't work.
    xp = reinterpret_cast< X* >(yp);
    // No cast required for conversion from pointer to void*
    void* p { xp };
    // Need reinterpret_cast for pointer conversion from void*
    xp = reinterpret_cast< X* >(p);
    // Need reinterpret_cast for reference conversion from unrelated classes
    // static_cast doesn't work.
    X& xr { x };
    Y& yr { reinterpret_cast< Y& >(x) };
    }

    You are correct about the reinterpret_cast() not being necessary in the following line:
    xp = reinterpret_cast< X* >(p);

    You can just use a static_cast():
    xp = static_cast< X* >(p);

    I will file this as an errata on the books website.

    I did not know about std::launder(). I will add this for the next edition.

  5. Raziel said,

    Wrote on March 15, 2021 @ 7:56 pm

    That’s the snippet, correct.
    As for std::launder, you can start here. https://en.cppreference.com/w/cpp/utility/launder
    The basic idea is that, according to standard, if pointer p of type T* obtained from pointer of type S* (let’s say a you use placement new to allocate elements on std::byte array) via reinterpret_cast, then manipulations with p are “undefined behavior”. Now assuming that there is actually an valid T object stored in the location, then by using std::launder(p) you can use it as you’d use regular pointer to T (there are some conditions need to be satisfied…). You also need to use std::launder using a pointer that points at result of placement new (unless you do something like T* p = new (address) T{…}) – if you use reinterpret_cast(address) without using p directly – you need to apply std::launder first to manipulate it).
    Does errata exist already?

  6. Marc Gregoire said,

    Wrote on March 16, 2021 @ 6:31 pm

    Thank you for the extra info about std::launder().
    It is a rather advanced feature though, so I’m not sure it should really be in this book. But in any case, I wrote it down and will look at it for the next edition.

    I requested the errata, but it’s not on the site yet. It should appear here: https://www.wiley.com/en-us/Professional+C%2B%2B%2C+5th+Edition-p-9781119695400

  7. Raziel said,

    Wrote on March 17, 2021 @ 11:31 am

    Is there a problem with putting advanced features in “Professional C++” book? Or by advanced you mean “isoteric and rarely used”?. I haven’t read the book from cover to cover yet, but it seems that constexpr also did not get much coverage in the book.

    I am not a professional C++ programmer (or professional programmer in general), but std::launder stuff is pretty essential at the moment when writing some types of data structures and memory allocators. I assume that this is not something that is done often in everyday job – “I did not have to implement linked list or hash table even once in my software development career, etc”, but these are “basic core CS concepts” and I have thought being able to implement them in your language of choice, is something a good C++ developer should be able to do.

  8. Marc Gregoire said,

    Wrote on March 18, 2021 @ 8:44 am

    Yes, correct, with “advanced feature” I did mean “rarely used feature”.
    I have never used std::launder() myself up to now, but you have a point and I will research it for the next edition.

    Constexpr is discussed in the book, but not all possible use cases. The C++ standard is becoming very big, so it’s becoming unrealistic to explain every single function and class in detail in a single book. Still, I might expand the constexpr discussion in a next edition.

  9. Raziel said,

    Wrote on July 4, 2021 @ 8:18 pm

    When will Errata be available?
    I could not find it on the publisher site yet.

  10. Marc Gregoire said,

    Wrote on July 7, 2021 @ 1:11 pm

    I’m in contact with the publisher and they told me that the errata should appear in the coming days.

  11. tilt said,

    Wrote on November 21, 2022 @ 2:33 am

    Hi, will Professional C++ release for c++23?

  12. Marc Gregoire said,

    Wrote on November 24, 2022 @ 3:56 pm

    “Hi, will Professional C++ release for c++23?”
    Yes, but end of 2023 or beginning of 2024.

  13. Ognjen Vukovic said,

    Wrote on September 6, 2023 @ 6:59 am

    Hi Marc,

    Just a quick question, could you please tell me how to get running the DirectedGraphBasic example in chapter 25 with VS 2022 and MSVC compiler? By the way, will there be an early release of 6th edition?

    Best,
    Ognjen

  14. Marc Gregoire said,

    Wrote on December 19, 2023 @ 6:59 pm

    The 6th edition will be available in January or February 2024.

    What’s the problem you’re having with compiling the DirectedGraphBasic example?

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment: