qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com
Subject: [Qemu-devel] [PATCH] CODING_STYLE: Define how to handle acronyms in CamelCase
Date: Mon, 24 Sep 2012 12:08:16 -0600	[thread overview]
Message-ID: <20120924175746.15361.32976.stgit@bling.home> (raw)

When creating structure names in CamelCase, it's easy to have
back-to-back capitals when using acronyms (ex. PCIINTxRoutingNotifier,
QEMUSGList, VFIOINTx).  In the worst case these can look like macros,
but even adjoining a single, all-caps acronym makes it more difficult
to interpret.  For example, is PCIIntxRoutingNotifier sufficiently
more clear?  Mixing case, such as VFIOintx isn't truly CamelCase.
Therefore let's abandon all-caps acronyms in CamelCase, resulting in
PciIntxRoutingNotifier, QemuSgList, VfioIntx.

Cc: Michael Tsirkin <mst@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

This is an attempt to formalize and get agreement on name changes
suggested for the vfio-pci driver.  VFIO is very prone to these naming
problems.  I don't expect to do any massive code churn to correct
these, but I will update vfio-pci to whatever outcome we decide and at
least we'll have a reference rather than per maintainer policy.
Thanks,

Alex

 CODING_STYLE |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/CODING_STYLE b/CODING_STYLE
index dcbce28..e45ed1a 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -53,6 +53,11 @@ and is therefore likely to be changed.
 When wrapping standard library functions, use the prefix qemu_ to alert
 readers that they are seeing a wrapped version; otherwise avoid this prefix.
 
+When making use of acronyms in CamelCase only capitalize the first character
+of the acronym.  This promotes readability and clearly defines the start of
+each word or acronym.  For example, instead of PCIBAR, use PciBar.  In place
+of QEMUDMAList, use QemuDmaList.
+
 4. Block structure
 
 Every indented statement is braced; even if the block contains just one

             reply	other threads:[~2012-09-24 18:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24 18:08 Alex Williamson [this message]
2012-09-24 20:01 ` [Qemu-devel] [PATCH] CODING_STYLE: Define how to handle acronyms in CamelCase Michael S. Tsirkin
2012-09-24 20:12   ` Alex Williamson
2012-09-26 21:59 ` Anthony Liguori
2012-09-27 19:33   ` Alex Williamson
2012-09-29 11:49   ` Blue Swirl

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=20120924175746.15361.32976.stgit@bling.home \
    --to=alex.williamson@redhat.com \
    --cc=mst@redhat.com \
    --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).