You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 extern or packed is impossible because it contains auto layout 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.
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:
externorpackedis impossible because it containsautolayout structs.