March 2023

Hardening C++ with Bjarne Stroustrup

An interview in Software Engineering Daily with Bjarne on the recent announcements by the NSA and the forthcoming CRA from the EU against the use of C++ based on security concerns.

Hardening C++ with Bjarne
Bjarne Stroustrup

From the interview:

Bjarne wishes for more support rather than calls to drop the use and teaching of C++ altogether. Especially in light of how much progress the C++ 17, 20 and 23 mean to the language but also how using the core guidelines and modern static analysis can reduce vulnerabilities considerably. 

Is boyer_moore_horspool faster then std::string::find?

The last blog post by Julien Jorge made me wonder if the string searchers could be faster here.

Is boyer_moore_horspool faster then std::string::find?

by Jens Weller

From the article:

On Wednesday I've read an interesting blog post by Julien Jorge on Effortful Performance Improvements, where it is shown how to improve an replace function which runs replacements on a string. Its part of a series on performance and improving a code base, you should go read all of them!

When reading the post, and seeing the two implementations, one short and simple and the other longer and more complicated - but faster - I wondered is there a faster way? Julien already has shown that his newer function beats his old function which uses std::string::find in performance. I've veryfied that, and then started to refactor a copy of that slower function with a different approach using the string search algorithm boyer_moore_horspool...

 

Workshops for C++ on Sea 2023

The C++ on Sea 2023 pre-conference, one-day workshops, are now available:

Workshops for C++ on Sea 2023

by C++ on Sea

About the workshops

Workshops on coroutines, concurrency and modern C++ idioms from Nathan Baggs, Rainer Grimm and Mateusz Pusz, respectively.

What do number conversions cost?

Exploring how much number conversions from string cost you and how caching helps

What do number conversions cost?

by Jens Weller

From the article:

And so the devil said: "what if there is an easier design AND implementation?"

In the last two blog posts I've been exploring some of the ways to implement a certain type that has a string_view and holds a conversion to a type in a variant or any. And my last blog post touched on conversions. And that made me wonder, what if I did not have a cache in the type for conversions? The memory foot print would be much smaller, and implementation could be simple to convert in a toType function on demand. This then would essentially be a type that holds a string_view, but offers ways to convert this view to a type. Adding a cache to hold the converted value is in this case not necessary, as this is done on demand.

C++20 Formatting Library, Parts 1. 2 and 3 -- Gajendra Gulgulia

1*YoSAmfIDl_BLrT70dHAe5Q.pngThe first three parts are live:

C++20 Formatting Library

by Gajendra Gulgulia

Part 1: Setup and Basics

Part 2: Width, Fill and Alignment

Part 3: Sign Specification

From the lead article:

At the time of writing this series, the header format is not yet integrated into latest gcc or clang compiler. According to reference the only two compilers that have so far implemented the standard text formatting libraries are clang-14* and msvc 19.29. Due to limitations in my personal computer, I’ll therefore be using the fmt library on which the standard string formatting library is based. When the compiler support is released, the token fmt::format can be replaced with std::format and the examples in the series should work as it is. ...

Getting Started with Boost.Asio: Timers and Serial Ports -- Richard Thomson

Utah C++ Programmers has released a new video.

Getting Started with Boost.Asio: Timers and Serial Ports

by Richard Thomson

From the video description:

I/O operations are inherently asynchronous -- we don't know when input will arrive and when output will be generated. Network I/O can be particularly bothersome because of the long delays between sending a request and obtaining the response.

Boost.Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach. Boost.Asio covers timers, serial ports, files, pipes and TCP/IP networking.

This month, Richard Thomson will give us an introduction to Boost.Asio concepts and asynchronous programming with this library. We'll look at how to use timers to notify our application of time passing and how to talk to serial ports asynchronously.

https://www.youtube.com/watch?v=XB3uEit5R_Y

Effortless Performance Improvements in C++: std::vector -- Julien Jorge

Screenshot_2023-03-09_070806.jpgPart the third:

Effortless Performance Improvements in C++: std::vector

by Julien Jorge

From the article:

This is the third post in the series about effortless performance improvements in C++. Check the first post to get the full story!

Last time we switched from std::map to std::unordered_map and got 30% performance improvements. After these changes we observed that the tokenize function was a top hotspot, mostly due to std::vector::push_back. How can we improve the performance of this function? ...

Next week: Meeting C++ online job fair

Next week is the first Meeting C++ online job fair in 2023!

Meeting C++ online job fair page

by Jens Weller

From the page:

Join the online C++ job fair on the 14th and 15th March organized by Meeting C++. The job fair will start at 15:00 CET and go until 18:00 on March 14th, on March 15th the event will be in the evening from 20 - 23:00 CET. Companies can choose to be present on both or only one of these events, or to only receive CVs through Meeting C++.

The job fair is an online event where employers and C++ job seekers get to meet each other. Candidates get the chance to get a first feel of a potential employer, and can exchange contacts with those that they'd like to apply to. Employers should book their own table and be present with one or multiple staff.

Merging intervals in next-gen C++--Marco Arena

Revisiting a classical programming puzzle in next generation C++:

Merging intervals in next-gen C++

by Marco Arena

From the article:

A few weeks ago, I set this problem at Coding Gym: given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input...