Debunking C++ Myths - Alexandru Bolboacă - E-Book

Debunking C++ Myths E-Book

Alexandru Bolboaca

0,0
28,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Think you know C++? Think again.
For decades, C++ has been clouded by myths and misunderstandings—from its early design decisions to misconceptions that still linger today. Claims like "C++ is too hard to learn" or "C++ is obsolete" are often rooted in some truth, but they are outdated and fail to capture the language’s ongoing evolution and modern capabilities.
Written by industry veterans with over 40 years of combined experience, this book uncovers the myths, exploring their origins and relevance in the context of today’s C++ landscape. It equips you with a deeper understanding of advanced features and best practices to elevate your projects. Each chapter tackles a specific misconception, shedding light on C++'s modern features, such as smart pointers, lambdas, and concurrency. You’ll learn practical strategies to navigate common challenges like code portability and compiler compatibility, as well as how to incorporate modern best practices into your C++ codebase to optimize performance and future-proof your projects.
By the end of this book, you’ll have a comprehensive understanding of C++'s evolution, equipping you to make informed decisions and harness its powerful features to enhance your skills, coding practices, and projects.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 364

Veröffentlichungsjahr: 2024

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Debunking C++ Myths

Embark on an insightful journey to uncover the truths behind popular C++ myths and misconceptions

Alexandru Bolboacă

Ferenc-Lajos Deák

Debunking C++ Myths

Copyright © 2024 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Kunal Sawant

Publishing Product Manager: Samriddhi Murarka

Book Project Manager: Farheen Fathima

Lead Editor: Kinnari Chohan

Technical Editor: Kavyashree K S

Copy Editor: Safis Editing

Proofreader: Kinnari Chohan

Indexer: Tejal Soni

Production Designer: Shankar Kalbhor

DevRel Marketing Coordinator: Sonia Chauhan

First published: December 2024

Production reference: 1221124

Published by Packt Publishing Ltd.

Grosvenor House

11 St Paul’s Square

Birmingham

B3 1RB, UK

ISBN 978-1-83588-478-2

www.packtpub.com

To Maria, my wife and partner. Thank you for your continuous support and advice.

– Alexandru Bolboacă

To my family, my heartfelt thanks; without their unwavering support and encouragement, I wouldn’t be where I am today.

– Ferenc-Lajos Deák

Contributors

About the authors

Alexandru Bolboacă is a CTO, passionate polyglot programmer, senior trainer, and advisor at Mozaic Works. With over 20 years in software development, he has worked for various industries, and in various European countries, as well as the UK and the USA. He has been involved in large projects in industries such as banking and financial services, energy, telecommunications, pharma, and eHealth. From practical experience, he advises and teaches architecture and usable software design, evolutionary design, crafting code, clean code, secure coding, and refactoring legacy code. Alex enjoys helping teams and organizations to understand and build strategies for successful and robust products, built-in quality, and motivation.

I want to thank a few people: the editors at Packt Publishing for reaching out to me for this project; the whole production team for supporting a smooth development; my colleagues at Mozaic Works for facilitating my writing schedule; Marius Bancilă for introducing me to Ferenc; and Ferenc for a great collaboration and for inspiring the witty and playful voice of this book. Finally, thank you to my formative mentor in C++, Luc Rogge.

Ferenc-Lajos Deák is a seasoned software developer with a strong foundation in mathematics and theoretical computer science, who is currently based in Trondheim, Norway. His career spans roles in diverse domains, including autonomous vehicles, real-time traffic systems, multimedia, and telecommunications. He is an avid open source fan, having several projects live and running, and has written more than a dozen articles for multiple technical publications concerning one of his passions: programming.

Kudos to my colleagues and managers at Maritime Robotics – their continuous stimulation and positive attitude truly paved the way for this book’s completion; to Marius Bancilă for introducing me to Alex; to Alex for a great collaboration and for being the sound voice of prose throughout the book; and to the people at Packt for making sure that what I write will also turn out to be publishable.

About the reviewer

Yuri Khrustalev is a software engineer with a rich background in building things from scratch. During his career, he helped to rewrite many legacy systems through reverse engineering. He enjoys using modern languages such as Zig, cpp, and Rust with a mix of Python and thinks that humanity will continue to demand engineers rather than managers.

Shivanjan Chakravorthy is a Senior Software Engineer at NVIDIA, based in Taiwan. A passionate tinkerer, Shivanjan enjoys coding as a means of innovation and exploration. He’s driven by a love for tackling challenging, unconventional projects that push creative boundaries. With expertise in AI, Python, Golang, and Kubernetes, Shivanjan actively seeks to give back to the tech community through his work.

Table of Contents

Preface

1

C++ Is Very Difficult to Learn

Technical requirements

Why is C++ perceived as difficult to learn?

The hard parts of C++ and how to grasp them

The Stroustrup method for learning C++

The Kate Gregory method – don’t teach C

The test-driven method for learning C++

Setup

Exploring the language

What about memory issues?

With great power…

Summary

2

Every C++ Program Is Standard-Compliant

Technical requirements

Somewhere in Ghana, far, far away

Microsoft’s tiny, squishy C++

The realm of free compilers

A tribute to attributes

When the header is not even C++

The curious case of C++ locked in a box

Past days of future C++

Summary

3

There’s a Single C++, and It Is Object-Oriented

Technical requirements

The multiple facets of C++

Functional programming in C++

Immutability

Pure functions

Operations on functions

Architectural patterns in functional style

Metaprogramming

Strong types to the limit

What about ignoring types?

Summary

4

The Main() Function is the Entry Point to Your Application

The main() function

The penguin farm

Oh no, there’s more!

A library is the delivery room for the birth of ideas unexpected behavior

Famous last words

Let’s open the Windows (unless you’re on ISS)

To PE or not to PE

Getting our hands dirty

Summary

5

In a C++ Class, Order Must There Be

Size does matter

The order that must be respected

Deep thoughts about order

The dark orders of C++

The most important question

When order does not matter

Summary

6

C++ Is Not Memory-Safe

Technical requirements

Memory safety is important

The memory safety problems of older C++

Modern C++ to the rescue

The limits of modern C++

There’s still more to do

Summary

7

There’s No Simple Way to Do Parallelism and Concurrency in C++

Technical requirements

Defining parallelism and concurrency

Common issues with parallelism and concurrency

Functional programming to the rescue!

The Actor Model

What we can’t do yet

Summary

8

The Fastest C++ Code is Inline Assembly

Light me a pixel

A note on the past

The sum of all numbers

A glimpse into the future

One instruction to rule them all

Summary

9

C++ Is Beautiful

In search of beauty

Who likes numbers?

The definition of zero

A parenthesis concerning parentheses

C++uties

Summary

10

There Are No Libraries For Modern Programming in C++

How can we tell?

A modern developer’s experience

Common needs

Compatibility

Supply chain security

Summary

11

C++ Is Backward Compatible ...Even with C

Is C really forward-compatible with C++?

The magic of the parameter list

Whitespace matters – until it doesn’t

The 11th guest

The auto surprise

Summary

12

Rust Will Replace C++

Technical requirements

Why the competition?

Core features of Rust

Project templates and package management

Immutability

Simple syntax for compound types

Optional return keyword

Closures

Unit tests in Standard Library

Traits

Ownership model

Rust’s advantages

Where C++ is better

What C++ still needs

Summary

Index

Other Books You May Enjoy