On 05/16/2014 04:41 AM, Kevin Wolf wrote:

>>> +} QEMU_PACKED QCowHeader;
>>
>> Is it worth a compile-time assertion that the correct size is achieved?
>>

> 
> QEMU_BUILD_BUG_ON() is what you're looking for.

Ah, thanks.

> 
> Do you think that would be a useful addition? With packed structs there
> should be little that could make it go wrong. But if we want to add
> this, I'd do it in a separate patch and for all image formats.

Definitely a separate patch.  But yes, I think that it can't hurt - even
with packed structs, it's a bit of insurance against someone
accidentally adding a field or using a wrong type, particularly for any
packed structs where a newer version converts reserved space into a
named purpose.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to