I have two structures in c++
struct Vertex {
float x,y,z;
float nx, ny, nz;
};
struct SkinnedVertex : public Vertex {
uint32_t j0, j1, j2, j3;
float w0, w1, w2, w3;
}
Now, when I use offsetof to get offset of Vertex, everything is fine but if I use offsetof in SkinnedVertex, I get the following warning when compiling with GCC:
warning: offsetof within non-standard-layout type ‘SkinnedVertex’ is conditionally-supported
My guess is that this happens because I am inheriting SkinnedVertex from Vertex, which makes this a non-standard-layout. But why does this happen? Does inheritance add additional information that makes this a non standard layout? Is thee a way to enforce it so that both of these structures are in standard layout?
EDIT: Changed jN types to uint32_t (was float)