Posts

C++20 Ranges

Image
Raw Loops to Ranges Most C++ code does not begin with elegant abstractions. It begins with simple loops and a problem to solve. It starts where a great deal of C++ starts: a flat vector, a few nested loops, and a stack of intermediate containers that exist only to feed the next loop in line. As the code grows, patterns emerge, abstractions appear, and the language offers better ways to express intent. One such addition is C++20 ranges, which is what this post explores. And there are many reasons why it took so long to become practical in production code. In any reasonably sized engineering organization, the choice of compiler is rarely driven by a single team. ABI compatibility requirements, toolchain support, third-party dependencies, and long-term maintenance concerns all have a say, and the lowest common denominator often wins. It is a shared contract. Every team, every internal library, and every third-party product linked into the build supports a particular set o...

How Mermaid Draws Diagram Without Crossing Arrows?

Image
Why Do Diagram Tools Struggle with Crossing Arrows? The Sugiyama Framework | Untangling a graph | VLSI Connections | ~12 Min Read | One afternoon, while working through a straightforward CPU subsystem consisting of a CPU, GIC, interconnect, and several peripherals including UART, memory, and Ethernet, I decided to generate a datasheet showing the platform's interfaces and connectivity.The SystemC description was remarkably clear. The structure flowed naturally, and anyone reading the platform configuration could understand the architecture almost instantly. Then I asked a tool to draw it.What emerged was a diagram far more complicated than the design itself. Connections crossed where they didn't need to. Router outputs twisted around each other. A return path sliced diagonally across the page, cutting through unrelated connections. The architecture hadn't changed, but its visual representation had become harder to understand than the source de...