From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SaOX1-00058M-IQ for qemu-devel@nongnu.org; Fri, 01 Jun 2012 05:52:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SaOWw-0006BH-NG for qemu-devel@nongnu.org; Fri, 01 Jun 2012 05:52:31 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49672 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SaOWw-0006B2-Go for qemu-devel@nongnu.org; Fri, 01 Jun 2012 05:52:26 -0400 Message-ID: <4FC890CE.8080005@suse.de> Date: Fri, 01 Jun 2012 11:52:14 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1338394747-17427-1-git-send-email-imammedo@redhat.com> <4FC6533C.3010207@samsung.com> <4FC744FE.3030203@redhat.com> <4FC7533B.2060102@redhat.com> In-Reply-To: <4FC7533B.2060102@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom-next] qom: make object cast assert if NULL object is passed as argument List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: aliguori@us.ibm.com, Igor Mitsyanko , alexander_barabash@mentor.com, Markus Armbruster , qemu-devel@nongnu.org, Paolo Bonzini Am 31.05.2012 13:17, schrieb Igor Mammedov: > On 05/31/2012 12:16 PM, Paolo Bonzini wrote: >> Il 31/05/2012 10:30, Markus Armbruster ha scritto: >>>>> Makes much sense, but maybe it should be done in OBJECT() cast? Ass= ert >>>>> when we do OBJECT(NULL). >>> In my opinion, OBJECT(p) where p is a null pointer is perfectly valid >>> and should yield a null pointer. >> >> Perhaps object_dynamic_cast and object_dynamic_cast_assert should do t= he >> same? >> >=20 > or better object_dynamic_cast should return NULL if obj is NULL, > after all it's expected that it may return NULL That's what I was suggesting: I think that we should define "NULL is not of type TYPE_FOO" and thus have the ..._is_... functions return false, and have the ..._cast_assert assert. So I still think this patch is correct. It could be accompanied by further patches adding error handling in the remaining functions. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg