#define member_size(type, member) sizeof(((type *)0)->member)
(reference: https://stackoverflow.com/questions/3553296/c-sizeof-single-struct-member)
// member_length
#define member_length(type, member) ((((type *)0)->member)+member_size(type, member))
If you use padding, it's is possible that member_length has some errors.
Comments
Post a Comment