-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
We commonly cast a type-erased ComponentStorage pointer to a Storage(u1) when we don't know its actual type, so that we perform component-agnostic operations on it.
This is technically undefined behavior, as there is no guarantee that the dummy type and the actual type have the same layout.
There are a few ways to fix this:
- Marking the ComponentStorage struct as
externorpackedis impossible because it containsautolayout structs.- We could make our own ArrayList and Allocator types so they could be extern, but that sucks for obvious reasons...
- We could create a non-generic InnerComponentStorage type that holds all the fields, then have ComponentStorage simply be a type-safe wrapper around it.
- Alternatively, we could make everything more generic, so that all component types are known at comptime. I personally prefer this one, as it would also fix @typeName is not guaranteed to be unique, and in fact has no guarantees #68.
- Finally, we could just do nothing, as it doesn't seem to have caused any issues thus far...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels