[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: |
Laszlo Ersek |
Subject: |
Re: [Qemu-devel] [PATCH v4 5/6] fw_cfg: add generic non-DMA read method |
Date: |
Thu, 5 Nov 2015 14:34:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 11/05/15 13:57, Markus Armbruster wrote:
> 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.
The 12 GB core dump that the Launchpad user, reporting the bug from the
other side of the Earth, failed to save? :)
But, I do concede your point. (Line numbers aren't a panacea either, in
situations like the above.) Gabriel, please pick whichever format you
like more.
Thanks
Laszlo
- Re: [Qemu-devel] [PATCH v4 4/6] fw_cfg: avoid calculating invalid current entry pointer, (continued)
- [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