Articles & Books

Refactoring the HTML Text Editor for QWebEngine

An update on the HTML Text Editor I hacked with Qt and TinyMCE3:

Refactoring the HTML Text Editor for QWebEngine

by Jens Weller

From the article:

In the last post, I described my experience with using MSVC as a compiler in combination with QtCreator. The reason I set this up was, that with Qt 5.7 QWebkit isn't anymore supported, and the HTML TextEditor based on tinymce3 is a central part of my application. Instead of QWebkit there is now QWebEngine, based on chromium, a very fine solution...

Overload 137 is now available

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

Overload 137 is now available

From the journal:

Mean Properties
Property based testing is all the rage. Russel Winder walks us through an example of properties an arithmetic mean function should have. by Russel Winder

The Importance of Back-of-Envelope Estimates
Guestimate questions make many people grumble. Sergey Ignatchenko reminds us why they matter. by Sergey Ignatchenko

Multiprocessing and Clusters in Python
Multiprocessing is possible in Python. Silas S. Brown shows us various ways. by Silas S. Brown

doctest – the Lightest C++ Unit Testing Framewor
C++ has many unit testing frameworks. Viktor Kirilov introduces doctest. by Viktor Kirilov

Correct Integer Operations with Minimal Runtime Penalties
Results of C++ integer operations are not guaranteed to be arithmetically correct. Robert Ramey introduces a library to enforce correct behaviour. by Robert Ramey

Quick Q: why there is no data-race in the following case?

Quick A: No write is triggered so no data race occurs.

Recently on SO:

why there is no data-race in the following case?

Data races are not static properties of your code. They are properties of the actual state of the program at execution time. So while that program could be in a state where the code would produce a data race, that's not the question.

The question is, given the state of the system, will the code cause a data race? And since the program is in a state such that neither thread will write to either variable, then the code will not cause a data race.

Data races aren't about what your code might do. It's about what they will do. Just as a function that takes a pointer isn't undefined behavior just because it uses the pointer without checking for NULL. It is only UB if someone passes a pointer that really is NULL.

Using QtCreator together with the Visual Studio Build Tools

A first posting about working with Qt and Visual C++ in QtCreator

Using QtCreator together with the Visual Studio Build Tools

by Jens Weller

From the article:

For a while I've been using QtCreator as my IDE, mostly because its deep integration with Qt, as most of my projects are Qt related. With this, I also preferred (and still do a little) to use the MinGW builds of Qt on Windows. In the past, as GCC was a little bit better with the newer standards, today, well, never change a running system...

Dependencies in the Gang of Four examples -- Zebedee Mason

Zebedee Mason discusses in his recent article some GOF idioms and analyzes them with his tool DeepsEnds.

Dependencies in the Gang of Four examples

by Zebedee Mason

From the article:

The example C++ code from the GoF (Gang of Four) book Design Patterns has had its dependencies analysed with DeepEnds. Certain examples have been refactored to remove circular dependencies enabled by pre-declaration of classes. These cycles in the graph serve to reduce the ability to subsequently modify the code with ease.

Fold Expressions--Rainer Grimm

Do you know how they work?

Fold Expressions

by Rainer Grimm

From the article:

With fold expressions you can implement the from Haskell known functions foldl, foldr, foldl1 and foldr1 directly in C++. These four functions successively reduce a list to a single value...

Un-Deprecate Your Qt Project--Giuseppe D'Angelo

Giuseppe D'Angelo explains how the Qt project deprecates APIs, a challenge every library project faces.

Un-Deprecate Your Qt Project

by Giuseppe D'Angelo

From the article:

Any product needs to evolve if it wants to remain competitive. If the development bandwidth is finite, from time to time there is the need to drop some ballast. This does not necessarily mean dropping working functionality and leaving users in the cold. At least in Qt most of the time this actually means replacing working functionality with better working functionality.

This process has being going on in Qt since forever, but since Qt 5.0 we’ve started to formalize it in terms of documentation hints and macros in the source code. This was done with a precise purpose: we wanted Qt users to discover if they were using deprecated APIs, and if so, let them know what better alternatives were available.

And since the very release of Qt 5.0.0 we’ve officially deprecated hundreds of APIs: a quick grep in QtBase alone reveals over 230 hits (mostly functions, but also entire classes).

C++ User Group Meetings in February

The monthly overview on upcoming C++ User Group Meetings:

C++ User Group meetings in February

by Jens Weller

From the article:

The monthly overview on upcoming C++ User Group meetings. For February there are already 33 User Group meetings planned. Also in this month are emBO++ and C++ Russia!

There are 4 new C++ User Groups: Nashua, NH, Vienna (Qt), Austin (Mentoring & Study Group), Montréal.

Stepanov-Regularity and Partially-Formed Objects vs. C++ Value Types -- Marc Mutz

Marc Mutz wrote in his recent article about the properties of default constructed object as required by Elements of Programming.

Stepanov-Regularity and Partially-Formed Objects vs. C++ Value Types

by Marc Mutz

From the article:

In this article, I will take a look at one of the fundamental concepts introduced in Alex Stepanov and Paul McJones’ seminal book “Elements of Programming” (EoP for short) — that of a (Semi-)Regular Type and Partially-Formed State.

Using these, I shall try to derive rules for C++ implementations of what are commonly called “value types”, focusing on the bare essentials, as I feel they have not been addressed in sufficient depth up to now: Special Member Functions.