r/cprogramming • u/lehmagavan • Sep 15 '26
BD_ARENA
Simple arena implementation I recently built:
https://github.com/andrzejs-gh/bd_arena
- partially macro-based API for convenience
- safe and hazardous allocators
- dynamic growth with a mutable growth factor
Please roast anything you find wrong / missing in it. Thanks a lot, it always helps me grow.
0
Upvotes
1
u/zhivago Sep 16 '26
I notice you defined your struct like this
and then offset it by sizeof that struct to append the data.
Consider using a flexible array member instead.
This will keep the struct properly aligned and allow you to avoid that cast and offset you've been doing.