[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: Paolo Bonzini
Subject: Re: [Qemu-devel] Why do we typedef every struct on QEMU?
Date: Thu, 19 Jul 2018 10:28:03 +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:
> 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

I think that does not entirely apply to us:

> It's a **mistake** to use typedef for structures and pointers. When you see a
> .. code-block:: c
>       vps_t a;
> in the source, what does it mean?
> In contrast, if it says
> .. code-block:: c
>       struct virtual_container *a;
> you can actually tell what ``a`` is.

We can actually tell that "a" is a struct in QEMU, because that's the
only place where we use CamelCase identifiers (typedefs for integer
types use lowercase names).  I agree with Linus that it's bad to use
typedef for pointers.



reply via email to

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