C++ Core Guidelines: Profiles--Rainer Grimm

To continue in the next one.

C++ Core Guidelines: Profiles

by Rainer Grimm

From the article:

Informally, profiles are a subset of rules of the C++ core guidelines for specific concerns such as type safety, bounds safety, and lifetime safety. Thanks to the guideline support library, they can be checked...

Cppcon-Tool Time 2019--Jon Kalb

Will you attend?

Tool Time 2019

by Jon Kalb

From the article:

Similar to tech labs at some other events, we’re offering the opportunity for anyone, from an author/creator, to a vendor, to a super-user, to represent a tool (app, library, framework, or service) and run their own table answering questions or showing demos...

C++20 Concepts Are Here in Visual Studio 2019 version 16.3

Compiler and library support for concepts is now available in Visual Studio 2019.

C++20 Concepts Are Here in Visual Studio 2019 version 16.3

by Xiang Fan

From the article:

C++20 Concepts are now supported for the first time in Visual Studio 2019 version 16.3 Preview 2. This includes both the compiler and standard library support.

First, we’re debuting the feature via /std:c++latest mode and once we have all C++20 features implemented across all Visual Studio products (compiler, library, IntelliSense, build system, debugger, etc.), we’ll provide them through a new /std:c++20 mode.

C++17 - The Complete Guide now complete and available -- Nicolai M. Josuttis

A new the latest book by Nicolai M. Josuttis is now complete and available.

C++17 - The Complete Guide

by Nicolai M. Josuttis

About the book:

The book is a full description of all language and library features that were introduced and modified with C++17.

It contains plenty of examples and many hints from using these new features in practice.

It is availble at your local book store or here.

 

 

Highlighting the Student and Support Tickets for Meeting C++ 2019

Also available in this year: the programs for students and diversity & support for Meeting C++ 2019

Highlighting the Student and Support Tickets for Meeting C++ 2019

by Jens Weller

From the article:

With the Schedule for Meeting C++ 2019 being complete regarding submitted talks, I want to highlight, that there is an opportunity for folks to attend the conference with a free ticket!

CppCon 2018: Modern C++ Design--Titus Winters

We’re in the final countdown to this year’s CppCon, which starts on September 16. To whet your appetite for this year’s conference, here’s another of the top-rated talks from last year. Enjoy – and register today for CppCon 2019!

Modern C++ Design (part 1 of 2)

Modern C++ Design (part 2 of 2)

by Titus Winters

Summary of the talk:

The old rules for C++API design are due for an update - we have made ad hoc changes to design principles in the standard library, but haven’t really written down the new ideas. Parameter passing and API design for free functions/member functions is due for a general update, particularly as a result of rvalue-references and reference qualification. How do we pass non-owning references? How do we sink a T? How do we express “maybe move” APIs? When do we want reference-qualified overload sets? What does an rvalue-reference qualified non-overloaded method mean? How do we express call once semantics?

For types, our consistency in producing Regular types has weakened in recent C++ releases with types like unique_ptr (move-only) and string_view (reference semantics). These classes of design that have shown themselves to be valuable, but certainly surprising at first. As we should not continue to extend the set of type designs arbitrarily, this is a good time to look at type design in the modern C++ era and narrow down the set of designs that are generally favored. This talk will focus on modern C++ design from small (choice of passing by value or reference) to large (Regular types, reference types, move-only types, etc). We will also introduce a taxonomy of type properties as a means to discuss known-good type design families.

We will also dive into the discussion of whether Regular design covers all good design, or whether there is more to the story.

Quick Q: Removing item from vector, while in C++11 range 'for' loop?

Quick A: it is not possible

Recently on SO:

Removing item from vector, while in C++11 range 'for' loop?

No, you can't. Range-based for is for when you need to access each element of a container once.

You should use the normal for loop or one of its cousins if you need to modify the container as you go along, access an element more than once, or otherwise iterate in a non-linear fashion through the container.

For example:

auto i = std::begin(inv);

while (i != std::end(inv)) {
    // Do some stuff
    if (blah)
        i = inv.erase(i);
    else
        ++i;
}

CppCon 2018: Spectre: Secrets, Side-Channels, Sandboxes, and Security--Chandler Carruth

We’re in the final countdown to this year’s CppCon, which starts on September 16. To whet your appetite for this year’s conference, here’s another of the top-rated talks from last year. Enjoy – and register today for CppCon 2019!

Spectre: Secrets, Side-Channels, Sandboxes, and Security

by Chandler Carruth

Summary of the talk:

The discovery of speculative execution side-channel attacks (called "Spectre") fundamentally changes the security model of every modern superscalar microprocessor. Extracting secret data (credit cards, cryptographic keys) through side-channels is not new and has challenged the cryptographic community for decades. Despite this, the industry has often been complacent in our response, viewing these attacks as impacting a tiny amount of code and being nearly impossible to weaponize. But speculative execution attack techniques have fundamentally altered the ease and applicability of side-channels, making them a serious threat to computer security. Responding to these issues has impacted CPU design, compiler design, library design, sandbox techniques and even the C++ programming language and standard.

This talk will explain how these kinds of attacks work at a high level and provide a clear set of terminology to describe these classes of vulnerabilities and attacks. It will show how the different variants work at the low level of modern hardware to give a detailed and precise understanding of the mechanics involved on CPUs today.

It will also provide guidance about what makes applications and services vulnerable and how to analyze your software to understand the degree of its exposure. It will include an overview of the numerous different mitigation techniques available, how to deploy them, and what tradeoffs come with them. Some of these mitigations will be covered in detail: how they work at a hardware level, where they don't work, and what attack vectors remain.

Finally, the talk will show how traditional side-channel risks are made substantially easier to exploit due to speculative execution. This will cover how cryptographic and other libraries dealing in high-value secrets need to be adapted to correctly defend against these attacks. Further, it will introduce general problems of sandboxing untrusted code from secret data and the current best techniques in those circumstances.

This talk will be accessible to most C and C++ programmers. No deep background on CPUs, assembly, hardware instructions, Spectre, side-channels, or security is needed.

Quick Q: How do C++ class members get initialized if I don't do it explicitly?

Quick A: default constructors are called if available, otherwise there is no initialisation.

Recently on SO:

How do C++ class members get initialized if I don't do it explicitly?

In lieu of explicit initialization, initialization of members in classes works identically to initialization of local variables in functions.

For objects, their default constructor is called. For example, for std::string, the default constructor sets it to an empty string. If the object's class does not have a default constructor, it will be a compile error if you do not explicitly initialize it.

For primitive types (pointers, ints, etc), they are not initialized -- they contain whatever arbitrary junk happened to be at that memory location previously.

For references (e.g. std::string&), it is illegal not to initialize them, and your compiler will complain and refuse to compile such code. References must always be initialized.

So, in your specific case, if they are not explicitly initialized:

    int *ptr;  // Contains junk
    string name;  // Empty string
    string *pname;  // Contains junk
    string &rname;  // Compile error
    const string &crname;  // Compile error
    int age;  // Contains junk