June 2023

CppCon 2022 The Lambda Calculus in C++ Lambdas -- David Stone

cppcon-2022-the-lambda-calculus-in-cpp-lambdas-david-stone.pngRegistration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2023!

Lightning Talk: The Lambda Calculus in C++ Lambdas

by David Stone

Summary of the talk:

The lambda calculus is a foundation of computation equivalent in power to Turing machines.

C++17’s Useful Features for Embedded Systems -- Çağlayan Dökme

caglayan.pngRecently, our team at Meteksan Defense is upgrading its development environment to use newer versions of many tools and programming languages. One of the more difficult transitions has been the upgrade of our C++11 code base to C++17 for our embedded applications.

In this article, I will be showing some features of C++17 that can also be helpful in the embedded world.

C++17’s Useful Features for Embedded Systems

by Çağlayan Dökme

From the article:

C++14 had smaller upgrades compared to the ones we saw when migrating to C++11 from C++03. Hence, there are only a few features in C++14 that you can use in an embedded system.

Binary Literals

If you are frequently dealing with bitwise operations and modifying registers, you will love these literals. Some compilers had extensions that support such literals, but now they have a place in the actual standard.

uint8_t a = 0b110; // == 6 
uint8_t b = 0b1111'1111; // == 255 

Constraint relaxed constexpr**

With C++14, the syntax you can use in a constexpr function is expanded. Check out this post on StackOverflow. The constexpr is beneficial in the embedded world since...

CppCon 2022 import CMake, CMake and C++20 Modules -- Bill Hoffman

cppcon-2022-import-cmake-cmake-and-cpp20-modules-bill-hoffman.pngRegistration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2023!

import CMake, CMake and C++20 Modules

by Bill Hoffman

Summary of the talk:

Originally developed as part of the National Institutes of Health (NIH) open source medical segmentation and registration toolkit ITK in 1999, CMake has grown to take on a vital role in the C++ ecosystem. Bill Hoffman, a founder of Kitware (www.kitware.com), and the creator of CMake will talk about where CMake is in 2022. The talk will start with a brief history of CMake and how it fits into the world of C++. It will then talk about recent developments to support C++20 modules.

For most of CMake's history, CMake has played catch up and implemented new features as compilers and IDEs have been released. With C++ modules, CMake developers have engaged the standards committee and compiler vendors to help craft the standard in such a way that CMake and other build systems can more seamlessly implement C++ modules. CMake has worked with Fortran modules for many years and has updated the ninja build tool to be able to dynamically update dependency information as it is discovered. To do this CMake requires a Fortran parser built into CMake. For obvious reasons CMake does not want to get into having its own C++ parser. This is the main driving force for pushing this work into the compilers. This talk will go over the road map for CMake C++ module support.

In addition to the history of CMake, C++ module support, this talk will include material covering important CMake features supporting the seamless building, testing and deployment of C++ across most computing platforms. In summary, listeners will learn about CMake origins, the roadmap of C++ module support in CMake and get an overview of the current set of features in CMake.

Reminder: CppCon 2023 Early Bird ends next Friday

On October 2, CppCon 2023 will start with Bjarne Stroustrup's opening keynote!

If you're interested in savings, the Early Bird discount for on-line and on-site tickets is available until next Friday, June 23. After that tickets will still be available right up to the conference, but at the full ticket price.

To register for CppCon 2023, click this link.

For details of on-line and on-site tickets, see the Registration page which includes information about student registration discounts, group rates, the CppCon Academy, the Diversity Dinner, the "Meet the Presenters" banquet, and much more!

On Writing Functions That Accept Any Specialization of a C++ Template Type -- Raymond Chen

RaymondChenPic.pngSuppose you want to write a template function that accepts any specialization of std::vector? What may work today may not work tomorrow.

On Writing Functions That Accept Any Specialization of a C++ Template Type

by Raymond Chen

From the article:

Suppose you want to write a template function that accepts any specialization of std::vector. Your first try would probably be something like this:

template<typename Value>
void accept_any_vector(std::vector<Value> v);

However, this does not actually accept any vector specialization. There is a second template argument for the allocator, which has a default value that nearly everyone uses. But if somebody has a vector with a custom allocator, then your function won’t match.

PVS-Studio 7.25: support for latest versions of Qt Creator, Rider, and more

PVS-Studio 7.25 has been released. In this version, we implemented the support of Qt Creator 10 and Rider 2022.2.3 (and higher), updated the libraries used by the analyzer, enhanced the documentation — and that's not all!

PVS-Studio 7.25: support for latest versions of Qt Creator, Rider, and more

by Nikita Lipilin

From the article:

When checking C++ projects that use MSBuild, PVS-Studio did not use the full power of Intel's 12th generation processors (for example, i7-12700, i9-12900). Apparently, the analysis processes were running only on energy-saving cores, while the rest remained idle. In the new version of PVS-Studio, the error has been fixed. Now the analyzer fully loads the processors and works much faster.

Pure Virtual C++ Videos Available

All videos from the Pure Virtual C++ 2023 conference are now online.

Pure Virtual C++ Videos Available

by Sy Brand

From the announcement:

Overall we had 18 videos on a wide variety of C++ topics, from Rust interop, to value semantics, to improving compiler errors.

CppCon 2022 Cute Approach for Polymorphism in C++ -- Liad Aben Sour Asayag

cppcon-2022-cute-approach-for-polymorphism-in-cpp-liad-aben-sour-asayag.pngRegistration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2023!

Lightning Talk: Cute Approach for Polymorphism in C++

by Liad Aben Sour Asayag

Summary of the talk:

I will talk about some tricks on how to stay generic and have good performance, while using polymorphism and virtual methods. Using aggregation.

Dealing with Mutation: Thread-Safe Interface -- Rainer Grimm

dealingwithmutations.pngI continue my journey with concurrency patterns in today's post. The Thread-Safe Interface fits very well when the critical sections are just objects.

Dealing with Mutation: Thread-Safe Interface

by Rainer Grimm

From the article:

The naive idea to protect all member functions of a class with a lock causes, in the best case, a performance issue and, in the worst case, a deadlock.

A Deadlock

The small code snippet has a deadlock.

struct Critical{
    void memberFunction1(){
        lock(mut);
        memberFunction2();
    ...
}

void memberFunction2(){
        lock(mut);
        ...
    }

    mutex mut;
};

Critical crit;
crit.memberFunction1();

Calling crit.memberFunction1 causes the mutex mut to be locked twice. For simplicity reasons, the lock is a scoped lock. Here are the two issues:

60 terrible tips for a C++ developer

In this article, you're going to find 60 terrible coding tips — and explanations of why they are terrible. It's a fun and serious piece at the same time. No matter how terrible these tips look, they aren't fiction, they are real: we saw them all in the real programming world.

60 terrible tips for a C++ developer

by Andrey Karpov

From the article:

Terrible tip N46. Write your code as if the chairman of the IOCCC judges will read it and as if they know where you live (to come and give you the prize).

It's a reference to a quote — "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live". This is John F. Woods's phrase, however, it's sometimes credited to Steve McConnell who quoted it in his "Code Complete" book.