From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbRt6-0003uM-LB for qemu-devel@nongnu.org; Mon, 04 Jun 2012 03:39:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbRt1-00030b-R4 for qemu-devel@nongnu.org; Mon, 04 Jun 2012 03:39:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbRt1-00030J-In for qemu-devel@nongnu.org; Mon, 04 Jun 2012 03:39:35 -0400 From: Markus Armbruster References: <1338394747-17427-1-git-send-email-imammedo@redhat.com> <4FC6533C.3010207@samsung.com> <4FC744FE.3030203@redhat.com> <4FC7533B.2060102@redhat.com> <4FC890CE.8080005@suse.de> <4FC8BDC6.70804@suse.de> Date: Mon, 04 Jun 2012 09:39:26 +0200 In-Reply-To: <4FC8BDC6.70804@suse.de> ("Andreas =?utf-8?Q?F=C3=A4rber=22's?= message of "Fri, 01 Jun 2012 15:04:06 +0200") Message-ID: MIME-Version: 1.0 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: Andreas =?utf-8?Q?F=C3=A4rber?= Cc: aliguori@us.ibm.com, Igor Mitsyanko , alexander_barabash@mentor.com, qemu-devel@nongnu.org, Paolo Bonzini , Igor Mammedov Andreas F=C3=A4rber writes: > Am 01.06.2012 13:18, schrieb Markus Armbruster: >> Andreas F=C3=A4rber writes: >>=20 >>> 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? As= sert >>>>>>>> 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 = the >>>>> same? >>>>> >>>> >>>> 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. >>=20 >> Is it? > > See http://www.mail-archive.com/qemu-devel@nongnu.org/msg113922.html > >> Igor: object_dynamic_cast should return NULL if obj is NULL, >>=20 >> You: have the ..._cast_assert assert [on null argument, I presume] >>=20 >> Doesn't sound like the same suggestion to me :) > > I'll let you to your opinion. :) However, my opinion is that My question isn't about a difference of opinions between us two. It's about Igor writing "X should do Y", and you replying "Yes, that's what I was suggesting, X should do !Y". There's a misunderstanding there, and it could well be mine. So I ask. [...]