From patchwork Mon Sep 24 18:08:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: CODING_STYLE: Define how to handle acronyms in CamelCase Date: Mon, 24 Sep 2012 08:08:16 -0000 From: Alex Williamson X-Patchwork-Id: 186493 Message-Id: <20120924175746.15361.32976.stgit@bling.home> To: qemu-devel@nongnu.org Cc: mst@redhat.com 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 Signed-off-by: Alex Williamson --- 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