lundi 1 octobre 2018

How to find space occupied by a struct field and the padding between it and the next field?

So if I have a struct like so:

struct A
{
    uint16_t First;
    uint8_t  Second;
}

I want to get the size including the offset prior to the next field of A::First. How do I do this? I'm not sure the proper way to use sizeof and alignof and offsetof to do this in the most correct way.

Aucun commentaire:

Enregistrer un commentaire