On 03/13/2012 11:58 AM, Andreas Färber wrote:

>>> +static void cpu_register(const ARMCPUInfo *info)
>>> +{
>>> +    TypeInfo type = {
>>> +        .name = info->name,

>>
>> Are non-initialized members guaranteed to be zero here?
> 
> I thought so for the C99-style struct initialization... I never ran into
> crashes while testing. Do we need static to be safe?

Yes, C99 guarantees in 6.7.8 p19:

The initialization shall occur in initializer list order, each
initializer provided for a particular subobject overriding any
previously listed initializer for the same subobject; all subobjects
that are not initialized explicitly shall be initialized implicitly the
same as objects that have static storage duration.

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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to