Blog

No Future for Us to C

It has been a while since some official documents produced by the USA administration advised against using unsafe programming languages like C and C++ (yes, C and C++ are explicitly mentioned). Now, the news resurfaced on the web with an added deadline—manufacturers have until January 1, 2026, to create a memory-safe roadmap for existing applications.

Let’s have a look at the text:

Recommended action: Software manufacturers should build products in a manner that systematically prevents the introduction of memory safety vulnerabilities, such as by using a memory safe language or hardware capabilities that prevent memory safety vulnerabilities. Additionally, software manufacturers should publish a memory safety roadmap by January 1, 2026.

This is pretty strict, even if it is phrased with “should” and not “shall” or “must”. If you develop a new product, you’d better drop C or C++. Moreover, if you have an existing product written in one of these pesky languages, you should provide a roadmap to memory safety.

Continue reading “No Future for Us to C”

Lambda World 2024

It was 2019 and nothing suggested that 2020 would not have been another regular year – another spring, another early bird ticket for the Lambda World conference, another regular summer, and then the most awaited conference of the year, a journey to Cadiz to attend Lambda World 2020.

Things went quite differently (for those reading from other planets – because of the pandemic) and the world was suddenly locked down, some conferences went online, and some were canceled, Lambda World included. Things went a bit better in 2021, but no news about a new edition of the functional programming conference. It was 2022, and many conferences had returned to the in-presence format, maybe with some precaution, but the worst part of the pandemic was finally over. Again no trace of Lambda World. 2023 came and went, and still no sign of lambda-life from Cadiz. Still vague or no answer to my emails to the organizing company.

And then suddenly and unexpectedly, the email popped up in my incoming folder – early bird ticket sale for Lambda World 2024 is open. I was so happy they were back, but at the same time I was about to change jobs and it was not the best approach to arrive on the first day at the new workplace and pretend to be sponsored to attend the conference. So, after a brief family check, I decided to self-sponsor my attendance and hope for at least some partial refund.

Continue reading “Lambda World 2024”

Fun with Functors in C

C language is old, actually, a very old language that resisted all the innovations that impacted the software development industries. Even ISO standard Cobol integrated object-oriented capabilities in 2002!

This didn’t prevent programmers from applying object-oriented programming to C. With some macro juggling and a lot of self-control not to break framework rules, you can have inheritance and dynamic dispatching.

Generic programming is, in the same way, foreign to C language1. You can use preprocessor macros to implement generic containers or functions that can be instantiated on the type you need, but it is a painful endeavor.

Continue reading “Fun with Functors in C”

Ad Astra

“Friends come and go, but enemies accumulate” [A. Bloch]. In my experience I never found a witty saying farther from truth than this.

I am about starting a new job and I am in the same mood and feelings I expressed here two years and something ago – thankful to the people I met and nervous to meet new people, although, I’m sure, they’ll be great people to work with and to share a good chunk of life.

Continue reading “Ad Astra”

What Happens in Monads Stays in Monads

There are moments in life when you have to take a stance. You know countless people already tried and possibly succeeded in doing something, but you feel the urge to try it yourself.

So yesterday I attended the Milan C++ Meetup by Marco Arena, presented in a very entertaining and well-organized way, what’s new in C++23. Everything was fine until Marco presented the std::expected template and its “monadic operations”. Now it was in the context of a much wider presentation and there was no time to go into details, but I got the impression that the C++ community has a bit of an ad-hoc approach to monads. I mean C++98 failed to recognize that containers are monads, C++11 failed to recognize that std::future is a monad, C++17 failed to recognize that std::optional is a monad, and C++20 failed to recognize that coroutines are monads. You can see a pattern there.

Continue reading “What Happens in Monads Stays in Monads”

It Is Exactly Twenty Years Today…

… since my first post in this blog:

I’ve just registered the domain ‘maxpagani.org’. This should be the first step in the online life of this site. A little step for a site, nearly unnoticeable for humanity :-D.

Thank you for visiting my website and reading my rants all these years!

It was 2004, and Facebook had just been founded but had still to reach critical mass and take off. RSS had to become a thing and Google Reader had to happen the next year, MySpace was still in its infancy, and “blogosphere” was the trending word. BTW the BASIC language just turned 40 that year.

Back then I worked at UbiStudios Milan and we were told the studios would be downsized, and that programmers would be better off looking for a job elsewhere. So I decided I needed some self-promotion and thought of this blog idea. A place where I could write about stuff that I like letting other people (possibly including prospective employers) know about me.

Initially, the blog was made with a bunch of static pages produced by a sort of template processor written in bash. This is how it looked. Later I implemented the blog section using PHP and plain files. I spent quite a lot of time on PHP trying to evolve the website and even prepared a second version with a better look. But eventually, I switched to WordPress.

I always wrote single, stand-alone posts, until I stumbled against PIC18. A microprocessor so unfriendly to C and so hostile to the high-level programmer, that I decided I needed to write a PIC18 survival guide that spanned over 5 posts. Since then I have written a few series, which I am quite proud of –

Since late 2023 I started collaborating with Embedded Related website and moved my publishing of … embedded related articles there. I plan to continue writing on my blog for everything else.

The Advent of Scala Code – What I Learned

It all started with an innocent-looking question, from a colleague – “This year I’d like to propose an office leaderboard for the Advent of Code, what do you think?”. Well, why not? I made a lame attempt at AoC some years ago and possibly gave up on the first day for lack of time (and commitment).

But this looked like an interesting challenge and I agreed and promoted the idea. Since I miss working in Scala, I wrote AoC solutions in Scala 3 to dust off some rust (ops) and learn the new syntax. Solving a (double) puzzle a day for 25 days (Xmas day included), is not a light endeavor. It requires at least from 1 to 2 hours and is increasingly difficult to squeeze into a normal working day especially if you have a life.

Continue reading “The Advent of Scala Code – What I Learned”