mirror of
https://github.com/kevinbentley/Descent3.git
synced 2026-04-04 02:00:04 -04:00
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).