qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [Qemu-devel] Why do we typedef every struct on QEMU?
Date: Thu, 19 Jul 2018 10:28:03 +0200	[thread overview]
Message-ID: <3492ade0-96bb-5821-f75d-0ca437aaf87d@redhat.com> (raw)
In-Reply-To: <87a7qnk9qa.fsf@dusky.pond.sub.org>

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.

Thanks,

Paolo

  parent reply	other threads:[~2018-07-19  8:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17 19:50 [Qemu-devel] Why do we typedef every struct on QEMU? Eduardo Habkost
2018-07-17 20:06 ` Peter Maydell
2018-07-19  6:42   ` Markus Armbruster
2018-07-19  8:18     ` Thomas Huth
2018-07-19  8:28     ` Paolo Bonzini [this message]
2018-07-27 13:03     ` Stefan Hajnoczi
2018-07-27 13:14       ` Daniel P. Berrangé
2018-07-27 13:16       ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3492ade0-96bb-5821-f75d-0ca437aaf87d@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).