offsetof
- From: "luke" <lroluk1@xxxxxxxxx>
- Date: 30 Sep 2005 02:17:50 -0700
hi all,
i have another question.
I've read the FAQ regarding my former question (sizeof struct and
union) and in question 2.14 it talks about offset macro.
#define offsetof(type, mem) ((size_t) \
((char *)&((type *)0)->mem - (char *)(type *)0))
Can anyone explain me how it works.
1)I can't understand what "0" casted to (type *) means
2)Isn't the second menber of substraction "(char *)(type *)0" useless?
.
- Follow-Ups:
- Re: offsetof
- From: darkknight
- Re: offsetof
- From: junky_fellow
- Re: offsetof
- Prev by Date: Re: Size of structs containing unions
- Next by Date: Re: performing a "deep copy" on a nested structure
- Previous by thread: performing a "deep copy" on a nested structure
- Next by thread: Re: offsetof
- Index(es):