[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.
[...]
- [Qemu-devel] [PATCH v4 4/6] fw_cfg: avoid calculating invalid current entry pointer, (continued)
- [Qemu-devel] [PATCH v4 4/6] fw_cfg: avoid calculating invalid current entry pointer, Gabriel L. Somlo, 2015/11/03
- [Qemu-devel] [PATCH v4 6/6] fw_cfg: replace ioport data read with generic method, Gabriel L. Somlo, 2015/11/03
- [Qemu-devel] [PATCH v4 3/6] fw_cfg: remove offset argument from callback prototype, Gabriel L. Somlo, 2015/11/03
- [Qemu-devel] [PATCH v4 2/6] fw_cfg: amend callback behavior spec to once per select, Gabriel L. Somlo, 2015/11/03
- [Qemu-devel] [PATCH v4 1/6] fw_cfg: move internal function call docs to header file, Gabriel L. Somlo, 2015/11/03
- [Qemu-devel] [PATCH v4 5/6] fw_cfg: add generic non-DMA read method, Gabriel L. Somlo, 2015/11/03