Received: from eggs.gnu.org ([2001:4830:134:3::10]:56793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuK6G-00029J-LU for qemu-devel@nongnu.org; Thu, 05 Nov 2015 07:57:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuK6D-0005x2-FM for qemu-devel@nongnu.org; Thu, 05 Nov 2015 07:57:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuK6D-0005w9-B4 for qemu-devel@nongnu.org; Thu, 05 Nov 2015 07:57:05 -0500 From: Markus Armbruster References: <1446586842-21793-1-git-send-email-somlo@cmu.edu> <1446586842-21793-6-git-send-email-somlo@cmu.edu> <563A1E69.40602@redhat.com> <20151104163505.GA4505@HEDWIG.INI.CMU.EDU> <563B4A33.7000708@redhat.com> Date: Thu, 05 Nov 2015 13:57:02 +0100 In-Reply-To: <563B4A33.7000708@redhat.com> (Laszlo Ersek's message of "Thu, 5 Nov 2015 13:23:15 +0100") Message-ID: <874mh0wqn5.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v4 5/6] fw_cfg: add generic non-DMA read method List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: peter.maydell@linaro.org, jordan.l.justen@intel.com, "Gabriel L. Somlo" , qemu-devel@nongnu.org, kraxel@redhat.com, pbonzini@redhat.com, markmb@redhat.com Laszlo Ersek writes: > On 11/04/15 17:35, Gabriel L. Somlo wrote: [...] >> + assert(size > 0 && size <= sizeof(value)); > > It's a matter of taste, and I won't insist at all, just mention that I > didn't write those two assert()s as separate statements :) > > Namely, with a conjunction (P1 && P2 && ... && Pn), you have the > possibility to spell the assertion as: > > assert(P1); > assert(P2); > ... > assert(Pn); > > And, if any one of those fails, you will know *which one*. Because the > line number in the "assertion failed" message will tell you. Yes, matter of taste, but that can't stop me having opinions on matters of taste ;) You pay for the more detailed assertion failure reporting with extra source code clutter (as written, it's immediately obvious that it's a bounds check, less so if split), and extra object code when NDEBUG is off (which it should always be). Personally, I'm content to fish details out of a core dump. YMMV. [...]