Preface

Welcome to the C++ programming language and C++20 for Programmers. This book presents leading-edge computing technologies for software developers.

These are exciting times in the programming-languages community with each of the major languages striving to keep pace with compelling new programming technologies. The ISO C++ Standards Committee now releases a new standard every three years and the compiler vendors implement the new features promptly. C++20 for Programmers is based on the new C++20 standard.

Live-Code Approach

At the heart of the book is the Deitel signature live-code approach. We present most concepts in the context of complete working programs followed by one or more sample executions. Read the Before You Begin section that follows this Preface to learn how to set up your Windows, macOS or Linux computer to run the hundreds of code examples. All the source code is available at

https://www.deitel.com/c-plus-plus-20-for-programmers

We recommend that you compile and run each program as you study it.

“Rough-Cut” E-Book for O’Reilly Online Learning Subscribers

You are viewing an early-access “rough cut” of C++20 for Programmers. We prepared this content carefully, but it has not yet been reviewed or copy edited and is subject to change. As we complete each chapter, we’ll post it here. Please send any corrections, comments, questions and suggestions for improvement to [email protected] and I’ll respond promptly. Check here frequently for updates.

“Sneak Peek” Videos for O’Reilly Online Learning Subscribers

As an O’Reilly Online Learning subscriber, you also have access to the “sneak peek” of our new C++20 Fundamentals LiveLessons videos at:

https://learning.oreilly.com/videos/c-20-fundamentals-parts/9780136875185

Co-author Paul Deitel immediately records each video lesson as we complete each rough-cut e-book chapter. Lessons go live on O’Reilly Online Learning a few days later. Again, check here frequently for updates.

Modern C++

20 The C++ programming language is popular for developing systems software, embedded systems, operating systems, real-time systems, computer games, communications systems and other high-performance computer applications. C++20 for Programmers is an introductory-through-intermediate-level, professional tutorial presentation of C++. The book is not a full-language reference manual, nor is it a “cookbook.” We focus on Modern C++, which consists of the four most recent C++ standards—C++11, C++14, C++17 and C++20. Throughout the book, features from these standards are marked with icons in the margins like the 20 icon shown here.

Compilers

We tested every program in the book on three popular free compilers:

• Visual C++ in Microsoft Visual Studio Community edition on Windows,

• Clang in Xcode on macOS, and

• GNU C++ on Linux and in the GNU Compiler Collection (GCC) Docker container.

At the time of this writing, some C++20 features are fully implemented in all three compilers, some are implemented in a subset of the three and some are not implemented at all. We point out these issues as appropriate and will update our online content as the compiler vendors implement the rest of C++20’s features. C++20 compiler support for many more compilers is tracked at

https://en.cppreference.com/w/cpp/compiler_support

We’ll also post updates on the book’s website at

https://deitel.com/books/c-plus-plus-20-for-programmers

Target Audiences

C++20 for Programmers and our C++20 Fundamentals LiveLessons videos have several target audiences:

• Non-C++ software developers who are about to do a C++ project and want to learn the latest version of the language, C++20, in the context of a professional-style, language tutorial.

• Software developers who may have learned C++ in college or used it professionally some time ago and want to refresh their C++ knowledge in the context of C++20.

• C++ software developers who want to learn C++20 in the context of a professional-style, language tutorial.

Images PERF Images Security Focus on Performance and Security Issues

Throughout the book, we call your attention to performance and security issues with the icons you see here in the margin.

“Objects Natural” Learning Approach

In your C++ programs, you’ll create and use many objects of carefully-developed-and-tested preexisting classes that enable you to perform significant tasks with minimal code. These classes typically come from:

• the C++ Standard Library,

• platform-specific libraries, such as those provided by Microsoft Windows, Apple macOS or various Linux versions,

• free third-party C++ libraries, often created by the open-source community, and

• libraries created by fellow developers, such as those in your organization.

To help you appreciate this style of programming, early in the book you’ll create and use objects of preexisting classes before creating your own custom classes in later chapters. We call this the “objects natural” approach.

Our “Objects Natural” Learning Approach evolved organically as we worked on our Python for Programmers book (https://learning.oreilly.com/library/view/python-for-programmers/9780135231364/) and our Python Fundamentals LiveLessons videos (https://learning.oreilly.com/videos/python-fundamentals/9780135917411), but C++20 for Programmers is the first book in which we’re using the term, “Objects Natural.”

“Rough-Cut” Table of Contents (Subject to Change)

Part 1: C++ Fundamentals Quickstart

1. Introduction and Test-Driving a C++ Application

2. Introduction to C++ Programming

3. Control Statements, Part 1; Intro to C++20 Text Formatting

4. Control Statements, Part 2

5. Functions

Part 2: Arrays, Pointers, Strings and Files

6. array, vectors, C++20 Ranges and Functional-Style Programming

7. (Downplaying) Pointers in Modern C++

8. string, Regular Expressions and Files

Part 3: Object-Oriented Programming

9. Classes

10. Inheritance and Polymorphism

11. Operator Overloading

12. Exceptions: A Deeper Look

Part 4: Standard Library Containers, Iterators and Algorithms

13. Standard Library Containers and Iterators

14. Standard Library Algorithms; Functional Programming: A Deeper Look

Part 5: Advanced Topics

15. C++20 Modules

16. Intro to Custom Templates and C++20 Concepts

17. Concurrent Programming; Intro to C++20 Coroutines

Part 6: Other Topics

18. Stream I/O; C++20 Text Formatting: A Deeper Look

19. Other Topics; A Look Toward C++23 and Contracts

Part 7: Appendices

A. Operator Precedence and Grouping

B. Character Set

C. Fundamental Types

D. Number Systems

E. Preprocessor

F. Bits, Characters, C Strings and structs

G. C Legacy Code Topics

H. Using the Visual Studio Debugger

I. Using the GNU C++ Debugger

J. Using the Xcode Debugger

Contacting the Authors

As you read the book, if you have questions, we’re easy to reach at

[email protected]

or

https://deitel.com/contact-us

We’ll respond promptly. For book updates, visit

https://deitel.com/c-plus-plus-20-for-programmers

Join the Deitel & Associates, Inc. Social Media Communities

Join the Deitel social media communities on

• Facebook®https://facebook.com/DeitelFan

• LinkedIn®https://bit.ly/DeitelLinkedIn

• Twitter®https://twitter.com/deitel

• YouTube®https://youtube.com/DeitelTV

About the Authors

Paul J. Deitel, CEO and Chief Technical Officer of Deitel & Associates, Inc., is an MIT graduate with 39 years of experience in computing. Paul is one of the world’s most experienced programming-languages trainers, having taught professional courses to software developers since 1992. He has delivered hundreds of programming courses to academic, industry, government and military clients internationally, including Pearson Education through O’Reilly Online Learning, Cisco, IBM, Siemens, Sun Microsystems (now Oracle), Dell, Fidelity, NASA at the Kennedy Space Center, the National Severe Storm Laboratory, White Sands Missile Range, Rogue Wave Software, Boeing, Nortel Networks, Puma, iRobot, UCLA and many more. He and his co-author, Dr. Harvey M. Deitel, are the world’s best-selling programming-language textbook/professional book/video/webinar authors.

Dr. Harvey M. Deitel, Chairman and Chief Strategy Officer of Deitel & Associates, Inc., has 59 years of experience in computing. Dr. Deitel earned B.S. and M.S. degrees in Electrical Engineering from MIT and a Ph.D. in Mathematics from Boston University— he studied computing in each of these programs before they spun off Computer Science. He has extensive college teaching experience, including earning tenure and serving as the Chairman of the Computer Science Department at Boston College before founding Deitel & Associates, Inc., in 1991 with his son, Paul. The Deitels’ publications have earned international recognition, with more than 100 translations published in Japanese, German, Russian, Spanish, French, Polish, Italian, Simplified Chinese, Traditional Chinese, Korean, Portuguese, Greek, Urdu and Turkish. Dr. Deitel has delivered hundreds of programming courses to academic, corporate, government and military clients.

About Deitel® & Associates, Inc.

Deitel & Associates, Inc., founded by Paul Deitel and Harvey Deitel, is an internationally recognized authoring and corporate training organization, specializing in computer programming languages, object technology, mobile app development and Internet-and-web software technology. The company’s training clients include some of the world’s largest companies, government agencies, branches of the military, and academic institutions. The company offers instructor-led training courses delivered at client sites worldwide on major programming languages.

Through its 45-year publishing partnership with Pearson/Prentice Hall, Deitel & Associates, Inc., publishes leading-edge programming textbooks and professional books in print and e-book formats, LiveLessons video courses, O’Reilly Online Learning live webinars and Revel™ interactive multimedia courses.

To learn more about Deitel on-site corporate training, visit

https://deitel.com/training

To request a proposal for on-site, instructor-led training worldwide, write to:

[email protected]

Individuals wishing to purchase Deitel books can do so at

https://www.amazon.com

Bulk orders by corporations, the government, the military and academic institutions should be placed directly with Pearson. For more information, visit

https://www.informit.com/store/sales.aspx
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset