On 08/16/2010 05:25 PM, Bruno Haible wrote:
> Eric,
> 
> Paul Eggert wrote:
>> unless this offsetof bug occurs in real code, it might
>> be better to not worry about it.
> 
> I agree. It's the first time in my life that I see someone doing
> 'sizeof' of an 'offsetof' expression. It's not a realistic use of the
> 'offsetof' macro.

Other than to test compliance to other aspects of offsetof.

Are there any other C expressions besides the sizeof operator where
injecting (cast)(expr) will cause a different parse than injecting
((cast)(expr))?

> 
> And the workaround is trivial: just add parentheses. It also makes the
> code easier to read:
>   sizeof (offsetof (struct d, e))

Then perhaps the simpler patch is to document the bug, but not test for
it, by simply committing test-stddef.c with redundant parenthesis; while
remembering this thread in case we do find other platforms that do have
more severe bugs with using the wrong type.

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to