On 26/05/2016 18:43, Jianjun Duan wrote: >>> The user may only care the position of head and entry. But to >>> implement QTAILQ_RAW_***, we need more offset information than that. >>> If we don't query the offsets using something like offset() and store >>> it in a metadata, we have to make the assumption that all the pointer >>> types have the same size. >> >> We make this assumption elsewhere anyway. _You_ are making it by doing >> loads and stores through void** in QTAILQ_RAW_*. > > I thought every data pointer can be converted to and from void type of > pointer. Anyway we can make that assumption here.
Yes, you can do that. > How about alignment? Is it OK to assume pointers are always aligned at > 4byte for 32 bit and 8byte for 64 bit? If yes then we can just add the > size of a void pointer to first to get last in QTAILQ head. We will get > something like: > first=0 > last = sizeof(void *) > next=0 > prev=sizeof(void *) Yes, that's my point. These four are constants. Thanks, Paolo