Files
Descent3/mem
Jan Engelhardt ce3a988ad6 Add a mem_malloc wrapper to check type triviality
UBSAN is reporting that some uninitialized variables. To that end, I
would like to add member default initializers to e.g. ``struct
object``. Doing that makes classes nontrivial.

Allocations throughout the code occur with e.g.
``mem_malloc(sizeof(T))``, which is, tersely speaking, incompatible
with triviality. Therefore, mem_malloc call sites will be rewritten
to invoke ``mem_rmalloc<T>`` instead, to enforce a compile-time check
that ``T`` is indeed trivial.

``mem_rmalloc<T>`` is modeled to look like ``make_unique<T>``, i.e.
can be called with no arguments to allocate space for a single thing,
or called with a size_t argument that specifies the number of
elements (automatic byte sizing is applied internally).
2024-09-16 21:57:41 +02:00
..