m42e@blog~%

  • unique_ptr are great

    Sidenote: Ok, so I couldn’t and will not try to stick to a plan of posting, I will post if I am in the mood of telling somebody something. I recently got in touch with rust, and read about it. Some things look nice, others rather strange. And a few...

  • Ignore the nodiscard

    I have recently decided to have [[nodiscard]] for every function that returns something. Every may have some exceptions but in general all normal every-day functions are defined [[nodiscard]]. This has two reasons: If there is a return value, it should mean something, so you should actively decide what to do....

  • Get rid of unions and some more advantages of std::variant.

    Let’s go back to C++17. It is already a while out there and a feature I really like is std::variant. It is handy in a lot of places. In all places you may have used unions before. Having an Interface which accepts a std::variant which it does not use itself,...

  • That did not start well. Missed already some weeks...

    Ok, here we are. I already missed some weeks, but hey, don’t mind. I wanted to challenge myself into writing and now I have to possibilities: Ignore the fact, that I missed already some weeks posts, or cancel the project completely because I missed my own expectations. And I have...

  • Conecpts or what do you require?

    Starting my regular blogging habit I do not want you to be bored out so I start with something that is new in C++20. C++20 is another big step forward to make templates even better. Or some would say a step into the so called meta-programming. But do not be...

  • Try something new

    This is my new challenge I try to write a blog post, once a week, with at least one C++ feature I either like or have learned about recently. I take bets on how long I continue this. I know a lot of others are doing this and you all...

  • CPPnow 2021 - Lightning Talk

    I had the opportunity to attend the CPPnow in 2021. I am glad is has been a online conference, because that way I could attend more easily. Besides a lot of interesting, educating and inspiring talks I pushed myself forward and into doing a lightning talk. My first public talk...

  • Must Everything be a Smart Pointer?

    TL;DR If you pass a smart pointer you include some ownership, a raw pointer doesn’t. But use it for every allocation. Should we only use smart pointers? During rewriting of a legacy C codebase to C++ I have been asked if everything should be changed to a smart pointer. I...

  • What is Most Important when Porting Legacy Software?

    I am currently working on a code base which is rather old an used to be C. It has been started over a decade ago and is still in use. As part of an automotive ECU it has seen a number of base systems it has been integrated to. If...

  • What are Inline Namespaces?

    Inline namespaces are transparent for those who are using the outer namespace. This is useful if you want to allow to narrow down the functions/classes/constants used, but do not want to add some more clutter if somebody wants to have them all. A simple example: Simple Example #include <iostream> namespace...