RSSAmplifier

Blog

Welcome to Johnny's World

Welcome to Johnny's World - Blog

marler8997.github.ioRSS feed ↗6 posts

Latest posts

I Fixed Windows Native Development

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…

Creating a Programming Language and God Mode in a Couple weekends

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…

Zig C++ Interop

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…

Simple Audio Conversion from Scratch

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.

The Zig Comptime Time Machine

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…

Bjarne fix your freaking language!

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…