[Top][All Lists]

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

Re: [Qemu-devel] Why do we typedef every struct on QEMU?

From: Thomas Huth
Subject: Re: [Qemu-devel] Why do we typedef every struct on QEMU?
Date: Thu, 19 Jul 2018 10:18:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 19.07.2018 08:42, Markus Armbruster wrote:
> Peter Maydell <address@hidden> writes:
>> On 17 July 2018 at 20:50, Eduardo Habkost <address@hidden> wrote:
>>> I have been looking at patches that touch typedefs.h and
>>> wondering: why do we make typedefs.h necessary at all?  Why do we
>>> always add typedefs for every struct and union type in QEMU?
>>> Why do we prefer to write this:
>>> ----- qemu/typedefs.h:
>>> typedef struct SomeType SomeType;
>>> ----------------------
>>> ----- qemu/somecode.h:
>>> #include <qemu/typedefs.h>
>>> int some_function(SomeType *a);
>>> ----------------------
>>> ...instead of simply writing this:?
>>> ----- qemu/somecode.h:
>>> struct SomeType;
>>> int some_function(struct SomeType *a);
>>> ----------------------
>>> Is the maintenance burden of typedefs.h worth it?
>> Personally I don't like typing "struct " all the time
>> when I'm using the type...
> For a different point of view (which I happen to share), see
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=024ddc0ce1049298bd3cae60ae45d9c5f0fb8b9c#n318

FWIW, as somebody who also has to write some kernel code occasionally,
I'd also prefer if we could get closer to the kernel coding style here

That would also avoid problems like this that we used to hit regularly:


(well, that problem will likely go away automatically since we now don't
support these distros anymore, but still...)


reply via email to

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