| OFFSETOF(3) | NetBSD Library Functions Manual | OFFSETOF(3) |
A compiler error will result if member is not aligned to a byte boundary (i.e. it is a bit-field).
struct example {
double x;
int y;
char z;
};
size_t x, y, z;
x = offsetof(struct example, x);
y = offsetof(struct example, y);
z = offsetof(struct example, z);
(void)printf("%zu %zu %zu\n", x, y, z);
| April 1, 2011 | NetBSD 5.99 |