...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <assert.h>
struct timer {
unsigned char MODE;
unsigned int DATA;
unsigned int COUNT;
};
int func(void) {
assert(sizeof(struct timer) == sizeof(unsigned char) + sizeof(unsigned int) + sizeof(unsigned int));
}
|
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <assert.h>
struct timer {
unsigned char MODE;
unsigned int DATA;
unsigned int COUNT;
};
static_assert(sizeof(struct timer) == sizeof(unsigned char) + sizeof(unsigned int) + sizeof(unsigned int),
"Structure must not have any padding");
|
...