70. static_assert

Question.1

A developer validates a communication packet struct:

struct __attribute__((packed)) Packet {
   uint8_t id;
   uint32_t payload;
};
static_assert(sizeof(Packet) == 5, "Packet must be 5 bytes");

What does this achieve?

Need Help? Refer to the Quick Guide below

Select Answer