August 2018

CopperSpice: Thread Safety

New video on the CopperSpice YouTube Channel:

Thread Safety

by Barbara Geller and Ansel Sermersheim

About the video:

This video covers concepts like thread safety, conditional thread safety, and reentrancy. We discuss the differences between these terms, the vital role that documentation plays in designing thread safe code, and how to effectively and clearly communicate the level of thread safety a particular function provides.

Please take a look and remember to subscribe!

C++17 In Detail - new book on C++ -- Bartlomiej Filipek

Learn the Exciting Features of The New C++ Standard with a new Book on C++

C++17 in Detail

by Bartlomiej Filipek

From the introduction:

C++17 was officially standardised in December 2017, giving us - developers - a wealth of new features to write better code.

This book describes all significant changes in the language and the Standard Library. What's more, it provides a lot of practical examples so you can quickly apply the knowledge to your code.

Results summary: C++ Foundation Developer Survey "Lite", 2018-08: C++ and Cloud

Over the past week, we ran our second global C++ developer survey, this time focusing on C++ use in cloud-related workloads.

Thank you to everyone who responded. As promised, here is a public summary of the results:

CppDevSurvey-2018-08-cloud-summary.pdf

This summary has now been forwarded to the C++ standards committee, along with the full text of your write-in answers. Your feedback will be very helpful, and thank you again for your participation!

CppCon 2017: My Little Object File: How Linkers Implement C++--Michael Spencer

Have you registered for CppCon 2018 in September? Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2017 for you to enjoy. Here is today’s feature:

My Little Object File: How Linkers Implement C++

by Michael Spencer

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Ever wonder how the linker turns your compiled C++ code into an executable file? Why the One Definition Rule exists? Or why your debug builds are so large? In this talk we'll take a deep dive and follow the story of our three adventurers, ELF, MachO, and COFF as they make their way out of Objectville carrying C++ translation units on their backs as they venture to become executables. We'll see as they make their way through the tangled forests of name mangling, climb the cliffs of thread local storage, and wade through the bogs of debug info. We'll see how they mostly follow the same path, but each approach the journey in their own way.

We'll also see that becoming an executable is not quite the end of their journey, as the dynamic linker awaits to bring them to yet a higher plane of existence as complete C++ programs running on a machine.

Overload 144 is now available

ACCU’s Overload journal of August 2018 is out. It contains the following C++ related articles.

Overload 146 is now available

From the journal:

Should I Lead by Example?
Stuck on a problem? Frances Buontempo considers where to turn to for inspiration.

Cache-Line Aware Data Structures.
Structuring your program to consider memory can improve performance. Wesley Maness and Richard Reich demonstrate this with a producer-consumer queue.

miso: Micro Signal/Slot Implementation.
The Observer pattern has many existing implementations. Deák Ferenc presents a new implementation using modern C++ techniques.

(Re)Actor Allocation at 15 CPU Cycles.
(Re)Actor serialisation requires an allocator. Sergey Ignatchenko, Dmytro Ivanchykhin and Marcos Bracco pare malloc/free down to 15 CPU cycles.

How to Write a Programming Language: Part 2, The Parser.
We’ve got our tokens: now we need to knit them together into trees. Andy Balaam continues writing a programming language with the parser.

Compile-time Data Structures in C++17: Part 1, Set of Types.
Compile time data structures can speed things up at runtime. Bronek Kozicki details an implementation of a compile time set.

Working with Makefiles in CLion using Compilation DB -- Phil Nash

CLion 2018.2 brought compilation database project format support. And it's more useful already than you may realize, as nowadays an increasing number of build systems allows generating comp db out of them. Typical example is Makefiles!

Working with Makefiles in CLion using Compilation DB

by Phil Nash

From the article:

Now that CLion can open Compilation DB JSON files it means it can effectively understand projects from many more build systems. This gives CLion full code-completion, static analysis, navigation and even refactoring on such projects. For 2018.2 we don’t yet have build (except for individual files) or debug capabilities – but these are planned for an upcoming release. To see just how useful this is, we’ll work through a couple of examples.

Sourcetrail 2018.3 released -- Eberhard Gräther

Sourcetrail is a cross-platform visual source explorer based on Clang libTooling

Sourcetrail 2018.3 released

by Eberhard Gräther

From the article:

Sourcetrail 2018.3 brings new usability features for faster source code exploration. Users can continue to browse while reindexing in the background. A graph legend and new node actions have been added to the graph visualization. The code view was extended with a local reference navigation. Project setup now supports Sonargraph and Code::Blocks project import.

CppCon 2017: So, you inherited a large code base...--David Sankel

Have you registered for CppCon 2018 in September? Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2017 for you to enjoy. Here is today’s feature:

So, you inherited a large code base...

by David Sankel

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

This is a talk about solving the most difficult problem a software engineer ever faces, converting a large codebase with antiquated designs and spotty quality into a state-of-the-art, modern system. We'll be covering clang-based refactoring, mnemonic reasoning methods, safe rewrites, coding standards, and, oh yes, migration paths.

If you've ever been tasked with making a legacy codebase the best-in-class, or think you might, then this talk is for you.

Should I Use Overloads or Default Parameters?--Jonathan Boccara

The answer is not obvious.

Should I Use Overloads or Default Parameters?

by Jonathan Boccara

From the article:

“Should I use overloads or default parameters”, haven’t you asked yourself that question?

When designing an interface where the user can leave the value of an argument up to the API, two approaches are possible:

Using a default parameters:

voiddrawPoint(int x, int y, Color color = Color::Black);
void drawPoint(int x, int y, Color color = Color::Black);

And using overloading:

void drawPoint(int x, int y); // draws a point in black
void drawPoint(int x, int y, Color color);

Which approach is cleaner? Which expresses better the intentions of the interface? Or is it just a matter of style?

This may be subjective, but I’m under the impression that overloading tends to have better popularity than default parameters amongst C++ developers. But I believe that both features have their usages, and it’s usefulto see what makes one or the other more adapted to a given situation.