News

How I declare my class and why -- Howard Hinnant

An experience-based opinion piece from one of the masters of C++:

How I declare my classes and why

by Howard Hinnant

Howard is the lead designer and author of move semantics, and a longtime C++ committee member where he has served as chair of the Library Working Group and is a current member and recent chair of the Direction Group.

From the article:

When I'm reading a class declaration, the very first things I want to know are:

  • What resources does this class own?
  • Can the class be default constructed?
  • Can the class be copied or moved?
  • How can the class be constructed (other than by default, copy or move)?
  • What else can one do with the class?

Note that this is an ordered list...

Virtual, final and override in C++--Jonathan Boccara

3 keywords that go together.

Virtual, final and override in C++

by Jonathan Boccara

From the article:

C++11 added two keywords that allow to better express your intentions with what you want to do with virtual functions: override and final. They allow to express your intentions both to fellow humans reading your code as well as to the compiler.

However, as we will see, the intention of override is super useful, but the intention of final… is harder to understand.

Both apply to virtual functions, which are the member functions of a base class that can be overridden by the classes that derive (inherit) from it...

Bjarne Stroustrup on C++20's significance

The following are notes from Bjarne Stroustrup, regarding the completion of C++20 on Saturday and summarizing his comments to the committee in the room:

After the 79-0 vote deeming C++20 done on February 15, 2020 in Prague, I made a few comments to emphasize the significance of the event. I got to the lectern just after Herb Sutter had shown photos of the C++ standards committee members at the first meeting and the meetings that voted for the C++11, C++14, C++17, and C++20 standards. I was in all of those, so was Mike Miller from EDG and chair of the Core Working Group. We were the only ones in all photos. This is roughly what I said:

This is a historical event:

  • 30 years of C++ standardization.
  • 40 years of C++.
  • C++20 is the 6th standard, the 3rd major standard; by “major” I mean “changes the way people think.”
  • This is something like the 75th meeting; I have been at about 70 of those.

I’d like to add a personal note. For me, C++20 is special because it has essentially all from “The Design and Evolution” (1994). In particular, it has concepts, modules, and coroutines:

  • Concepts were not in D&E, but there were three pages of apologies for not having them. Then, neither I nor anyone else know how to design and implement them sufficiently well.
  • Modules were just a dream then, but they were specifically mentioned – I dreamed of a day where we could finally eliminate the preprocessor.
  • Coroutines were the  bread and butter for C++ during the first 10 years; they were missing in most other languages. I was sore having lost them to implementation problems on SPARC architecture.

In addition, we get improved concurrency and a library with ranges, dates, and span.

We (the C++ standards committee members) must be careful and responsible; we serve a huge community:

  • Serve the community at large, rather than just experts – “keep simple things simple.”
  • Be careful, the world changes; what seems essential or fashionable today may not be good in the longer term.
  • Be pragmatic, not doctrinaire; pragmatic and principled.

This has guided the development of C++ so far. No, that’s not easy. We must balance many concerns. I suggest we:

  • Pursue the goal of a completely resource-safe and type-safe C++.
  • Support a wide variety of hardware well.
  • Maintain C++’s record of stability (compatibility) – “stability is a feature” – as much as makes sense.

These aims have served C++ well throughout.

I wonder who’ll be here in 30 years? That’ll be 2050.

Thanks for listening. See you in Varna! (Varna is the location of the next ISO C++ Standards meeting).

Freestanding in Prague--Ben Craig

All you want to know.

Freestanding in Prague

by Ben Craig

From the article:

The C++ standards committee met in Prague, Czech Republic between Feb 10 and Feb 15. The standard is wording complete, and the only thing between here and getting it published is ISO process. As is typical for me at these meetings, I spent a lot of time doing freestanding things, Library Incubator (LEWGI) things, and minuting along the way (15-ish sessions/papers!)...

Move, simply--Herb Sutter

No need to get complicated.

Move, simply

by Herb Sutter

From the article:

C++ “move” semantics are simple, but they are still widely misunderstood. This post is an attempt to shed light on that situation...

C++20: The Ranges Library--Rainer Grimm

One big of c++20.

C++20: The Ranges Library

by Rainer Grimm

From the article:

Thanks to the ranges library in C++20, working with the Standard Template Library (STL) will become much more comfortable and powerful. The algorithms of the ranges library are lazy, can work directly on the container and can easily be composed. To make it short: The comfort and the power of the ranges library are due to its functional ideas. Let me show you what that means...

CopperSpice: Moving to C++17

New video on the CopperSpice YouTube Channel:

Moving to C++17

by Barbara Geller and Ansel Sermersheim

About the video:

In this video, we look at some of the significant improvements that were added to the language in C++17, and how they can apply to your code base. We also present some interesting questions you might want to ask, or be able to answer, in an interview for a position using C++17.

Please take a look and remember to subscribe!

Large-Scale C++: Process and Architecture --- John Lakos

Writing reliable and maintainable C++ software is hard. Designing such software at scale adds a new set of challenges. Creating large-scale systems requires a practical understanding of logical design — beyond the theoretical concepts addressed in most popular texts. To be successful on an enterprise scale, developers must also address physical design, a dimension of software engineering that may be unfamiliar even to expert developers. How do you do this?

Large-Scale C++ Volume I: Process and Architecture

by John Lakos

From the article:

Drawing on over 30 years of hands-on experience building massive, mission-critical enterprise systems, John Lakos lays the foundation for projects of all sizes and demonstrates the processes, methods, techniques, and tools needed for successful real-world, large-scale development.

Up to date and with a solid engineering focus, this book demonstrates fundamental design concepts with concrete examples.

This book, written for fellow software practitioners, uses familiar C++ constructs to solve real-world problems while identifying (and motivating) modern C++ alternatives.