lundi 19 août 2019

automatic assign class padding macro name

I have a class that i need to use padding for.

At the moment it works fine.

But i wanted to know how would i automatically assign the padding name so i dont need 2 arguments, would just like to call it with the size of padding only.

#define PAD(loc, size)  private: \
                    char __pad##loc[size]; \
                    public:
class Class
{
public:
    PAD(0x0028, 16);
    uint32_t        Flags;                  //0x0038
    void*           Model;                  //0x003C
    PAD(0x0040, 4);
    uint32_t        ID;                     //0x0044
};

Aucun commentaire:

Enregistrer un commentaire