This:
struct Vec3* v = malloc(sizeof(struct Vec3));
is better written as:
struct Vec3 * const v = malloc(sizeof *v);
I don't love this. Other people are going to think you're only allocating a pointer. It's potentially confusing.Uh, okay, but if you need to constantly write code as if people reading it don't understand the language, then ... I don't know how to do that. :)
It's not possible to know C code and think that
sizeof *v
and sizeof v
somehow mean the same thing, at least not to me.
I also personally find totally confusing leaving the * in the middle of nowhere, like flapping in the breeze.