Looking at S-Core today feels a bit like walking into a German factory that has just announced a “major transformation initiative.” Before anything actually starts to change, there are: The intention is good, but as my colleague from work pointed out some time ago: “bureaucracy expands to meet the needs…
c++
How to write Arduino Uno code with Python?
Recently I came across a Reddit thread where someone asked: “I was thinking about using an Arduino, but I have been learning Python and do not want to learn a whole other programming language to do basic things that an Arduino can. (Planning on making a robot, will be using…
Bug of the week #11
Welcome to the next pikoTutorial ! The error we’re handling today is a C++ compilation error: What does it mean? It often occurs when the compiler encounters a place in the code where it would normally expect a static member function, but the actual function is not static. Let’s say…
Folding expressions in C++
Welcome to the next pikoTutorial ! What is a folding expression? Imagine that you have a vector of integers and you need to add some predefined values to it. The obvious choice seems to be just using push_back() function applied a couple of times: This works, but look how much…
Bug of the week #10
Welcome to the next pikoTutorial ! The error we’re handling today is a C++ compilation error: Or a similar one: What does it mean? This error occurs in situations when you provide a declaration of a type, but don’t provide definition of that type. For example, if I try to…
Trying ROS2: client/server within a single container
Welcome to the next pikoTutorial ! In the first article of Trying ROS2 series I showed how to implement and examine a basic publisher and subscriber within a single Docker container. Now it’s time for checking out how do you implement and set up a client/server connection within a single…
Make C++ a better place #4: Go as an alternative
The Go programming language brings simplicity and a clear design philosophy that make it attractive for developers who are tired of the complexity of C++. In this article, we will explore the most interesting features of the Go language that distinguish it from C++. Producer/consumer implementation with Go If you…
Separating builds for different configs with Bazel
Welcome to the next pikoTutorial ! Let’s consider a simple project with the following structure: The main function has 2 compile switches: And we have 2 separate Bazel configurations including these switches: When we build the application with the following command: I can run the application by invoking: But as…
Destruction order vs thread safety in C++
Welcome to the next pikoTutorial ! What’s the problem? Let’s take a look at the simple example below: Let’s quickly sum up what’s going on here and what could be the expected output of such program: To understand why it happens, let’s add a custom deleter to the unique pointer,…
Let’s review some code: C++ #2
Below you can find the code that we will be reviewing today. Before you scroll down to section where I fix it, feel free to check how many mistakes you can find. Without running this code, one could expect that the output which it generates looks like this: But when…
Make C++ a better place #3: D as an alternative
The D programming language, commonly known as DLang, offered a fresh perspective on system-level programming by blending familiar features of C++ with modern mechanisms to enhance code safety, simplicity, and performance. Created by Walter Bright, it is meant to be a viable alternative to C++ for developers seeking to improve…
Registering callback using std::function in C++
Welcome to the next pikoTutorial! Imagine you’re building an application that processes some data and once it’s done, the user needs to be notified about the result. Since you don’t want to hard-code the notification logic, it’s better to allow the user to register a custom function that will be…
Bug of the week #8
Welcome to the next pikoTutorial! The error we’re handling today is a C++ compilation error: What does it mean? In C++, the error occurs when you try to invoke a function that has been explicitly marked as deleted or implicitly deleted by the compiler. This error commonly arises in relation…
Calling member function on a nullptr in C++
Welcome to the next pikoTutorial! nullptr and the segmentation fault One of the first things that beginner C++ programmers realize after starting to play around with pointers is that dereferencing a nullptr leads to an immediate program crash caused by the segmentation fault. This leads to a common belief that…
Bug of the week #7
Welcome to the next pikoTutorial! The error we’re handling today is a C++ compilation error: What does it mean? The requirement for main to return an integer stems from convention and standardization within the programming languages. In C and C++, the main function is typically defined with a return type…
Make C++ a better place #2: CppFront as an alternative
In this article, we will explore how CppFront aims to make C++ a better place by introducing a new syntax, improving safety and usability and providing modern features that align with good programming practices – all while maintaining full interoperability with C++. The origins and philosophy of CppFront CppFront is…
Parameters combinations in GoogleTest
Welcome to the next pikoTutorial! Parameterized unit tests are priceless. They help to test code thoroughly through multiple possible input values, without having to write multiple and almost the same unit tests – if you have a function accepting an enum and output for some of them is the same,…
Custom literals in C++
Welcome to the next pikoTutorial! What are C++ literals? Literals in C++ are constant values directly embedded into the code, such as numbers, characters and strings. They represent fundamental data, making the code more readable and expressive. C++ provides several built-in literals, like integer literals (42), floating-point literals (3.14), and…
Make C++ a better place #1: What does better mean
Let’s define word “better” In the title of this series, I used the term “better”, but as an engineer, I can’t begin my research with such a vague objective. The world of software engineering is so complex and varied that word “better” can have very different meanings depending on the…
Enums vs enum class in C++
Welcome to the next pikoTutorial! When dealing with enumerations in C++, developers have two primary options: traditional enum and enum class. Traditional enums vs enum classes At the first glance, the only difference appears to be in the class keyword: The real difference is however in how both of them…
Bug of the week #5
A segmentation fault, often referred to as a ‘segfault,’ is a specific kind of error encountered in computing when a program tries to access a memory location that it is not allowed to access.
Functions calling order in unit tests in C++
To ensure a certain order of function calls, GTest provides 2 ways to do that: InSequence and Sequence objects.
Make C++ a better place #0: Introduction
The world of software development is built on dreams of engineers who aspired to create their own programming languages.
Build & run C++ unit tests with CMake
Welcome to the next pikoTutorial! Building and running a single test file To present the easiest case, we need to assume some folder structure of our project: Here the easiest case means that we have only on library and only one test file for it. Firstly of all, we need…
Let’s review some code #1: C++
Below you can find the code that we will be reviewing today. Before you scroll down, feel free to check how many mistakes you can find.
5 ways of passing unique pointer to a function in C++
std::unique_ptr is one of the most common non-copyable types – types, whose constructor has been explicitly deleted in their implementation.
Bug of the week #2
ISO C++ forbids declaration with no type – check what does it mean and how to fix that error.
5 least known STL utilities in C++
Learn about 5 least known yet very useful utilities from STL like std::shared_mutex or std::clamp.
How to dockerize a C++ application?
If you ever wanted to ensure a consistent environment for your application, you most probably know that containerization is the way to go.
Why implement custom copy constructor in C++?
Nowadays there are many high level languages in which you don’t have to care about how objects are copied around. However, if you want to write in C++, you must understand that copying is a very distinct operation.
Welcome to pikoTutorial!
Your best source of byte-sized programming knowledge! Inspired by the SI unit prefix “piko” (10^-12), our portal aims to deliver short software tutorials.