qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/7] target-alpha: Turn CPU definitions into sub


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 2/7] target-alpha: Turn CPU definitions into subclasses
Date: Thu, 06 Dec 2012 17:21:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

Am 06.12.2012 17:09, schrieb Eduardo Habkost:
> On Thu, Dec 06, 2012 at 04:51:31PM +0100, Andreas Färber wrote:
>> Am 06.12.2012 16:29, schrieb Eduardo Habkost:
>>> On Wed, Oct 31, 2012 at 04:03:59AM +0100, Andreas Färber wrote:
>>> [...]
>>>> +static void alpha_cpu_register(const AlphaCPUInfo *info)
>>>> +{
>>>> +    TypeInfo type_info = {
>>>> +        .name = info->name,
>>>> +        .parent = TYPE_ALPHA_CPU,
>>>> +        .instance_init = info->initfn,
>>>> +    };
>>>> +
>>>> +    type_register_static(&type_info);
>>>
>>> You should use type_register() instead of type_register_static(), here.
>>
>> I still don't understand why. (CC'ing Anthony, Paolo, Peter)
>>
>> The TypeInfo argument is in no way retained inside
>> qom/object.c:type_register_internal().
>> Therefore the lifetime of TypeInfo should be completely irrelevant for
>> the static/non-static decision and the documentation should be fixed IMO.
>> Is there a reason to do it differently? What would we want to do with
>> TypeInfo after transfer of its field values to TypeImpl?
> 
> The current implementation doesn't matter. It can change at any minute. The
> interface, on the other hand, is documented as:
> 
>   type_register_static:
>   @info: The #TypeInfo of the new type.
> 
>   @info and all of the strings it points to should exist for the life time
>   that the type is registered.

Both implementation and documentation can be changed. My question is,
why does the documentation say this and where does Anthony (or Paolo)
want to go with the current implementation that makes this necessary.

Like, if we switched to C++, we would drop both registration functions
completely.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]