From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm1rG-00037C-CD for qemu-devel@nongnu.org; Thu, 28 Nov 2013 08:42:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vm1r6-0007wS-HG for qemu-devel@nongnu.org; Thu, 28 Nov 2013 08:42:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm1r6-0007v5-8c for qemu-devel@nongnu.org; Thu, 28 Nov 2013 08:42:08 -0500 Message-ID: <5297480B.9050501@redhat.com> Date: Thu, 28 Nov 2013 14:41:31 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1385601858-8065-1-git-send-email-imammedo@redhat.com> <20131128142323.01a88c7e@nial.usersys.redhat.com> In-Reply-To: <20131128142323.01a88c7e@nial.usersys.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qom: abort on error in property setter if caller passed errp == NULL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Peter Crosthwaite , "Michael S. Tsirkin" , "qemu-devel@nongnu.org Developers" , Anthony Liguori , =?ISO-8859-1?Q?Andreas_F=E4rber?= Il 28/11/2013 14:23, Igor Mammedov ha scritto: > > object_property_set(Foo, bar, "baz", &abort_on_err); > > that is just another way to put burden on caller, instead of doing it > in one place. It's also much more self-documenting. The problem is that there is one very good case where you want the silent-don't-care behavior: when you don't care about the exact error, and you can figure out whether there was an error from the returned value of the function. This doesn't apply to object_property_set of course, but it is the reason why NULL Error* has silent-don't-care behavior. Now, let's look at the alternatives: * keep silent don't care + consistent + predictable - not always handy * only modify object_property_set + mostly does the right thing - inconsistent with other Error* functions - inconsistent with _nofail functions * Peter's alternative + self-documenting + consistent + predictable * make Error* mandatory for all void functions + consistent + almost predictable (because in C you can ignore return values) - not necessarily does the right thing (e.g. cleanup functions) - requires manual effort to abide to the policy I vote for Peter's proposal, or for adding object_property_set_nofail. No particular preference. Another variant: modify object_property_set to add a g_warning. I think it's fine. It reduces the inconsistency, and still simplifies debugging. Paolo