qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] qtest protocol: should memset/read/write etc of a size


From: Peter Maydell
Subject: Re: [Qemu-devel] qtest protocol: should memset/read/write etc of a size of 0 bytes be permitted?
Date: Fri, 5 Aug 2016 10:47:35 +0100

On 5 August 2016 at 07:46, Markus Armbruster <address@hidden> wrote:
> For me, this is one of those pointless UBs, whose only effect on the
> real world is wasting programmer time.  Seriously, what else could a
> sane memset(NULL, 0, 0) do?

Since the function call is annotated in the system headers
to indicate that the first argument isn't NULL, it gives
the compiler more information which it can then use to
delete clearly-never-reachable "if (foo == NULL) { ... }"
codepaths for you :-)

thanks
-- PMM



reply via email to

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