January 2021

Semaphores in C++20--Rainer Grimm

A new useful construct in the standard library.

Semaphores in C++20

by Rainer Grimm

From the article:

Semaphores are a synchronization mechanism used to control concurrent access to a shared resource. They also allow it to play ping-pong...

Build Throughput Series: Template Metaprogramming Fundamentals--Xiang Fan

Optimise templates.

Build Throughput Series: Template Metaprogramming Fundamentals

by Xiang Fan

From the article:

Template metaprogramming is popular and seen in many code bases. However, it often contributes to long compile times. When investigating build throughput improvement opportunities in large codebases, our finding is that more than one million template specializations and template instantiations is quite common and often provides optimization opportunities for significant improvement.

In this blog post, I will walk through the differences between template specialization and template instantiation and how they are processed in the MSVC compiler...

4 Features of Boost HOF That Will Make Your Code Simpler--Jonathan Boccara

Convinced?

4 Features of Boost HOF That Will Make Your Code Simpler

by Jonathan Boccara

From the article:

Boost HOF, standing for Higher Order Functions, is a Boost library offering functions that work on functions.

This impressive library provides a lot of advanced components allowing to go a step further into functional programming in C++. In this post, we’ll focus on 4 of the more basic ones (+ a bonus one) that allow to make code simpler in common tasks.

HOF provides one header in the form of #include <boost/hof/XXX.hpp> for each component, as well as a general header #include <boost/hof.hpp>. It is compatible with C++11...

Reusable HTTP(S) Connections--Richard Hodges

With boost.

Reusable HTTP(S) Connections

by Richard Hodges

From the article:

Something I am often asked by users of Boost Beast is how to code a client which effectively re-uses a pool of HTTP connections, in the same way a web browser does.

The premise is straightforward - if our client is going to be making multiple calls to a web server (or several of them) then it makes sense that once a connection has been used for one request, it is returned to a connection pool so that a subsequent request can make use of it...

GotW #97 Solution: Assertions -- Herb Sutter

tmp.PNGSolution just posted:

GotW #97 Solution: Assertions

by Herb Sutter

From the article:

Assertions have been a foundational tool for writing understandable computer code since we could write computer code... far older than C’s assert() macro, they go back to at least John von Neumann and Herman Goldstine (1947) and Alan Turing (1949). [1,2] How well do we understand them... exactly?

 

ACCU Overload 160 -- accu.org

The latest magazine of ACCU is online available or as paper copy for members.

by accu.org

From the index

Debt – My First Thirty Years.
Reflecting on code often reveals gnarliness. Frances Buontempo reminds herself about all the tech debt she’s ever caused.

Questions on the Form of Software.
Writing software can be difficult. Lucian Teodorescu considers whether these difficulties are rooted in the essence of development.

Building g++ From the GCC Modules Branch.
Using the WSL to build the g++ modules branch. Roger Orr demonstrates how to get a compiler that supports modules up and running.

Consuming the uk-covid19 API.
Covid-19 data is available in many places. Donald Hernik demonstrates how to wrangle data out of the UK API.

What is the Strict Aliasing Rule and Why Do We Care?
Type Punning, Undefined Behavior and Alignment, Oh My! Strict aliasing is explained.

Afterwood.
Design Patterns emerged last century. Chris Oldwood explains why he thinks they are still relevant.

Include What You Use--Jonathan Boccara

Did you know that tool?

Include What You Use

by Jonathan Boccara

From the article:

I’ve used the clang based include-what-you-use tool on a fairly large chunk of code — a couple of hundreds of files, containing dozens of includes each.

That was an interesting experiment.

Here are my takeaways on this powerful tool, what it can bring to your code, and a few things I wish I had known when I started using it...

C++ at the end of 2020--Bartlomiej Filipek

A summary of the year and the future.

C++ at the end of 2020

by Bartlomiej Filipek

From the article:

While 2020 was a crazy and hard year we were fortunate - C++20 was accepted and published, and the work on new features continues.

As usually every year, here’s my overview of the year: the standardization process, features, implementation, compilers, tools, books and more...