-
Recently, I made a stupid mistake that made me think about the way C++ APIs handle dependencies and what we can do to prevent dangling references and lifetime issues. 🤔
It was a surprisingly fun topic to explore that led me to the discovery of a very cool static analysis tool. Can you guess which one? 😎
You can find out in the article I wrote about the topic here:
➤ https://medium.com/@nerudaj/type-safe-dependency-management-in-c-a293703f00ff -
People often claim that memory-safe languages eliminate the class of memory bugs, but that is not true and can give less experienced devs a false sense of security.
You can violate borrow checker at runtime in Rust with zero unsafe blocks. You can have null-pointer dereference in C#. You can index out of bounds in Java.
The difference is that while C++ will crash at unspecified time with SIGSEGV (or not crash at all), memory-safe languages will either crash at a well-defined time in a well-defined way, or they will emit an exception you shall handle.
In the customers eyes, that might not even be a difference.
-
Are you using std::ranges in your C++ code? If not, what is stopping you?
Ranges introduced a huge paradigm shift in the way we can write our C++ code. They can make the code way shorter, way better separated, and what's best - way more resilient to both logical and memory-related bugs. 🐞
If you haven't yet dabbled in ranges yourself, I've prepared a kind of cheatsheet reference article exploring many everyday use cases and how they can be improved by using the std::ranges library. 📏
You can read the article for free on my Medium:
➤ https://medium.com/@nerudaj/you-need-to-start-using-c-s-ranges-cf80c9f38602What are your experiences with this library? Tell me in the comments 👇
-
One of the things a good CMake-powered C++ library should do is to test its own integration - in other words, if others can plug it into their projects. One reason is obvious - nobody will use your library if they can't. The second one is pragmatic - the tests act as documentation for the users.
I've spent many hours refining my integration testing of CMake code, and I've compiled my learnings into the following article:
➤ https://medium.com/@nerudaj/cmake-integration-testing-4d71184525eaI've also fallen into the inevitable rabbit hole of dependency management in CMake, so if you want to learn about that, the article has you covered as well! 😵💫
What do you think? Are there other aspects of integration that are worth testing? And would you be interested in an article on how to make findable prebuilt packages with CMake?
-
Wow, trailer for DLC for #Prodeus looks like it will be more fun than the base game!
Hopefully I'll get the GoG version working on Steam Deck, #nintendoswitch version had really inconsistent FPS. ☹️