On Thu, Feb 7, 2013 at 4:55 PM, Anthony Liguori <aligu...@us.ibm.com> wrote:
> Stefan Hajnoczi <stefa...@gmail.com> writes:
>
>> On Thu, Feb 7, 2013 at 3:43 PM, Laszlo Ersek <ler...@redhat.com> wrote:
>>> Instead, what about
>>>
>>> #define endof(container, field) \
>>>     (offsetof(container, field) + sizeof ((container *)0)->field)
>>
>> As mentioned in my reply, I think endof() isn't necessary.
>>
>> Just use offsetof() the *next* field or sizeof() the entire struct
>> (for the last field).  That way you let someone else do the dirty
>> pointer tricks.
>
> You don't always have a next field so it would get syntactically
> awkward.

Use sizeof() the entire struct for the last field.

Stefan

Reply via email to