qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 5/6] fw_cfg: add generic non-DMA read method


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v4 5/6] fw_cfg: add generic non-DMA read method
Date: Thu, 05 Nov 2015 13:57:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Laszlo Ersek <address@hidden> 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.

[...]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]