I like 'aFoo'. Nick
On Tue, Jul 7, 2015 at 1:12 PM, Jeff Gilbert <jgilb...@mozilla.com> wrote: > I propose that we stop recommending the universal use of an 'a' prefix for > arguments to functions in C and C++. If the prefix helps with > disambiguation, that's fine. However, use of this prefix should not be > prescribed in general. > > `aFoo` does not provide any additional safety that I know of.[1] As a > superfluous prefix, it adds visual noise, reducing immediate readability of > all function declarations and subsequent usage of the variables within the > function definition. > > Notable works or style guides [2] which do not recommend `aFoo`: [3] > * Google > * Linux Kernel > * Bjarne Stroustrup > * GCC > * LLVM > * Java Style (Java, non-C) > * PEP 0008 (Python, non-C) > * FreeBSD > * Unreal Engine > * Unity3D (largely C#) > * Spidermonkey > * Daala > * RR > * Rust > * Folly (from Facebook) > * C++ STL entrypoints > * IDL for web specs on W3C and WhatWG > * etc. > > Notable works or style guides which *do* recommend `aFoo`: > * Mozilla (except for IDL, Java, and Python) > * ? > > 3rd-party projects in our tree which do not use `aFoo`: > * Cairo > * Skia > * ANGLE > * HarfBuzz > * ICU > * Chromium IPC > * everything under modules/ that isn't an nsFoo.c/cpp/h > * etc.? > > 3rd-party projects in our tree which *do* recommend `aFoo`: > * ? > > As far as I can tell, the entire industry disagrees with us (as well as a > number of our own projects), which means we should have a good reason or > two for making our choice. No such reason is detailed in the style guide. > > I propose we strike the `aFoo` recommendation from the Mozilla style guide. > > - > > [1]: Maybe it prevents accidental shadowing? No: Either this isn't allowed > by spec, or at least MSVC 2013 errors when compiling this. > > [2]: I do not mean this as an endorsement of the listed works and guides, > but rather as illustration on how unusual our choice is. > > [3]: I created an Etherpad into which people are welcome to gather other > works, projects, or style guides that I missed: > https://etherpad.mozilla.org/6FcHs9mJYQ > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform