EmbeddedRelated.com

Massimiliano Pagani (@maxpagani)

Max started coding back in the 80s when computers were laughably slow, never had enough RAM, and used tape recorders as storage memory. Since then, he never stopped writing bugs and other features. He worked in the video game industry, had some exposure to server and service development, got fascinated by functional programming, and spent several years writing firmware and embedded software. When he is struck by something he reckons interesting, and has enough spare time, he writes on his blog at https://www.maxpagani.org/.

Unuglify C++ FSM with DSL

Massimiliano Pagani May 7, 2024

Domain Specific Languages (DSL) are an effective way to avoid boilerplate or repetitive code. Using DSLs lets the programmer focus on the problem domain, rather than the mechanisms used to solve it. Here I show how to design and implement a DSL using the C++ preprocessor, using the FSM library, and the examples I presented in my previous articles.


Simple C++ State Machine Engine

Massimiliano Pagani March 14, 2024

When implementing state machines in your project it is an advantage to rely on a tried and tested state machine engine. This component is reused for every kind of application and helps the developer focus on the domain part of the software. In this article, the design process that turns a custom C++ code into a finite-state machine engine is fully described with motivations and tradeoffs for each iteration.


There's a State in This Machine!

Massimiliano Pagani February 5, 20243 comments

An introduction to state machines and their implementation. Working from an intuitive definition of the state machine concept, we will start with a straightforward implementation then we evolve it into a more robust and engineered solution.


Lightweight C++ Error-Codes Handling

Massimiliano Pagani November 16, 20232 comments

The traditional C++ approach to error handling tends to distinguish the happy path from the unhappy path. This makes handling errors hard (or at least boring) to write and hard to read. In this post, I present a technique based on chaining operations that merges the happy and the unhappy paths. Thanks to C++ template and inlining the proposed technique is lightweight and can be used proficiently for embedded software.


Indeed this cannot be a general strategy for dynamic memory management. What I am suggesting is to leverage the pattern of allocation/deallocation of your objects,...
Can you elaborate this part what did you meant by "domain knowledge"?The idea is that a general allocator must work with any order of allocation/deallocations and...
@lgacnik97Possibly a general approach to memory management either shares the same issues new/delete (or malloc/free) have or requires a very large pool from where...
Hi, there are already great replies, I would like to add that - the problem with dynamic memory (in general, but more relevant for resource-constrained systems),...

Use this form to contact maxpagani

Before you can contact a member of the *Related Sites:

  • You must be logged in (register here)
  • You must confirm you email address