Imagine you’re maintaining a native project. You use Visual Studio for building on Windows, so you do the responsible thing and list it as a dependency Build Requirements: Install Visual Studio If you’re lucky enough not to know this yet, I envy you. Unfortunately, at this point even Boromir knows… Well put Boromir What you may not realize is, you’ve actually signed up to be unpaid tech support…
A couple weeks ago my gaming group wanted to play the game R.E.P.O , a hilarious co-op horror game. We’d played it many times before and had become accustomed to a mod that allowed us to share upgrades . These upgrades are crucial to surviving further into the game, but they require paying your very limited resources to buy and only apply to a single player. This made the upgrades a point of…
I’ve been writing Zig and C++ that have to talk to each other. I want both languages to be able to store data types from the other in their own structs/classes. const c = @cImport ( { @cInclude ( "cppstuff.h" ) ; } ) ; const MyZigType = struct { foo : c . SharedPtrFoo , } ; #include <zigstuff.h> class MyCppType { ZigFoo foo ; } ; Keep in mind, I don’t want to just define all my Zig types as extern…
I’m currently using miniaudio for converting between audio formats, however, it’s allocating dynamic memory for the converter and I’d like to understand why. To do so, let’s first implement the simplest conversion we can think of that doesn’t use any dynamic memory.
NOTE: code examples use zig version 0.14.1 One of the coolest things about Zig is comptime . It empowers the user and can result in fewer branches, tighter loops, and faster runtime, but here’s the fun part: Zig also gives us a time machine . With a bit of “pixie dust”, you can take a runtime value and project it backwards into the compiler’s world as a comptime value . Let’s see how: Start with…
About 23 minutes into his talk about Safe C++ [1], Bjarne shows a slide with this code: void f ( const char * p ) // unsafe, naive use { FILE * f = fopen ( p , "r" ) ; // acquire // use f fclose ( f ) ; // release } He shows this code to demonstrate how easy it is to miss resource cleanup. Any code that exits the function inside // use f that doesn’t also call fclose results in a leak. He provides…