sizeof a struc field

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Oct 17 14:52:56 AEST 1989


In article <10201 at xanth.cs.odu.edu> kremer at cs.odu.edu (Lloyd Kremer) writes:
>Neither is adequate if you wish to know the effective size of the member
>including structure padding.

Then use the difference of two offsetof()s.
The size of struct padding is not very useful to know;
it's the offset of a struct member that is the
information of use in programming.
offsetof() is required to be provided by the implementation
precisely because there is no portable way of computing
struct member offsets without it.



More information about the Comp.lang.c mailing list