wendt@bocklin.UUCP (08/01/85)
I'm wrong about sizeof(struct {char a;}), as Jerry Schwartz informs me. > Using the size of a structure containing a single char to find > out about alignment requirements is not portable. While many > compilers will round up the size of such structures there > is no guarantee that they will round to the maximum requirement. > (E.g. they might round to 4 bytes on a machine that requires > doubles to be aligned at 8 bytes) What about sizeof(struct {char a; double b;}) - sizeof(double) . This assumes that the alignment requirements for double are the most stringent. The assumption could be removed by maximizing over all types or something, but the result would probably break some preprocessors.