[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 01/19] Use #include "..." for our own headers
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 01/19] Use #include "..." for our own headers, <...> for others |
Date: |
Thu, 1 Feb 2018 07:08:11 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 02/01/2018 01:12 AM, Markus Armbruster wrote:
>>> +
>>> #include "qemu/osdep.h"
>>> +#include <memory.h>
>>
>> <memory.h> is an obsolete spelling for the now-universal <string.h>. We
>> should NEVER need to include it; scripts/clean-includes should be taught
>> to blacklist this one.
>
> "Programming today is a race between software engineers striving to
> build bigger and better idiot-proof programs, and the Universe trying to
> produce bigger and better idiots. So far, the Universe is winning."
>
> My point is: if we extended our tooling every time we see a mistake,
> we'll drown in tooling. I think we should limit ourselves to *common*
> mistakes. Is this one common?
Perhaps not; a tendency when writing a new file is to copy-and-paste a
list of includes from another file, then add more if things still don't
compile. Since adding memory.h never changes whether compilation will
work (unless you forgot osdep.h in the first place, and thereby missed
string.h), and if we eradicate all current uses of memory.h, new uses
won't have the bad example to copy from.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature