Let\'s say, I have a struct RGB and I want to create struct RGBA, which inherits RGB:
struct RGB {
unsigned char r
It's easy to check for padding: Print sizeof(RGB) and sizeof(RGBA). If it's not 3 respective 4 then the structures are padded, and you need to remove it.
As for if the member a comes after b, you can use offsetof to check each members offset. If the offset for a is one larger than the offset of b then a comes directly after b.