From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgeD8-00055G-5g for qemu-devel@nongnu.org; Thu, 06 Dec 2012 11:22:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgeD2-0000B2-8I for qemu-devel@nongnu.org; Thu, 06 Dec 2012 11:22:06 -0500 Received: from cantor2.suse.de ([195.135.220.15]:37866 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgeD1-0000At-VR for qemu-devel@nongnu.org; Thu, 06 Dec 2012 11:22:00 -0500 Message-ID: <50C0C623.2010408@suse.de> Date: Thu, 06 Dec 2012 17:21:55 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1351652644-18687-1-git-send-email-afaerber@suse.de> <1351652644-18687-3-git-send-email-afaerber@suse.de> <20121206152933.GG4986@otherpad.lan.raisama.net> <50C0BF03.90206@suse.de> <20121206160938.GT4255@otherpad.lan.raisama.net> In-Reply-To: <20121206160938.GT4255@otherpad.lan.raisama.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/7] target-alpha: Turn CPU definitions into subclasses List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org, Anthony Liguori , rth@twiddle.net Am 06.12.2012 17:09, schrieb Eduardo Habkost: > On Thu, Dec 06, 2012 at 04:51:31PM +0100, Andreas F=E4rber wrote: >> Am 06.12.2012 16:29, schrieb Eduardo Habkost: >>> On Wed, Oct 31, 2012 at 04:03:59AM +0100, Andreas F=E4rber wrote: >>> [...] >>>> +static void alpha_cpu_register(const AlphaCPUInfo *info) >>>> +{ >>>> + TypeInfo type_info =3D { >>>> + .name =3D info->name, >>>> + .parent =3D TYPE_ALPHA_CPU, >>>> + .instance_init =3D info->initfn, >>>> + }; >>>> + >>>> + type_register_static(&type_info); >>> >>> You should use type_register() instead of type_register_static(), her= e. >> >> 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 I= MO. >> Is there a reason to do it differently? What would we want to do with >> TypeInfo after transfer of its field values to TypeImpl? >=20 > The current implementation doesn't matter. It can change at any minute.= The > interface, on the other hand, is documented as: >=20 > type_register_static: > @info: The #TypeInfo of the new type. >=20 > @info and all of the strings it points to should exist for the life t= ime > 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 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg