Generic Containers in C: Safe Division Using Maybe

uecker.codeberg.page

Generic Containers in C: Safe Division Using Maybe. Martin Uecker, 2025-08-10 I discuss the implementation of type and bounds safe generic containers in C. Previously, I discussed a span type, bounds checking using arrays. and a a vector type. This … Read more

Generic interfaces

go.dev

Axel Wagner7 July 2025 There is an idea that is not obvious until you hear about it for the first time: as interfaces are types themselves, they too can have type parameters. This idea proves to be surprisingly powerful when … Read more

Generic dynamic array in 60 lines of C

gist.github.com
generic-dynamic-array-in-60-lines-of-c

#pragma once #define DYN_ARR_OF(type) struct { type *data; type *endptr; uint32_t capacity; } #if !defined(__cplusplus) #define decltype(x) void* #endif #define DYN_ARR_RESET(a, c) { a.data = (decltype(a.data))malloc(sizeof(a.data[0]) * c); a.endptr = a.data; a.capacity = c; } #define DYN_ARR_RESIZE(a, s) { uint32_t … Read more