better-enums icon indicating copy to clipboard operation
better-enums copied to clipboard

Use in a packed struct

Open vervaekejonathan opened this issue 4 years ago • 1 comments

BETTER_ENUM(address_t, uint8_t, one = 0x01, two = 0x02);
struct query_t {
    address_t address;
} __attribute__((packed, aligned(1)));

Gives a warning: ignoring packed attribute because of unpacked non-POD field 'address_t query_t::address'

vervaekejonathan avatar May 05 '21 07:05 vervaekejonathan

Try adding

#define BETTER_ENUMS_CLASS_ATTRIBUTE __attribute__((packed, aligned(1)))

before the enum. See Injecting tokens.

aantron avatar May 05 '21 10:05 aantron