[cfe-dev] draft rule for naming types/functions/variables
Zhanyong Wan (λx.x x)
wan at google.com
Mon Nov 22 21:36:37 PST 2010
On Mon, Nov 22, 2010 at 9:30 PM, Chandler Carruth <chandlerc at google.com> wrote:
> Sorry, this seems to have not followed the thread, but here was my comment:
> http://codereview.appspot.com/3264041/diff/1/docs/CodingStandards.html#newcode801
> docs/CodingStandards.html:801: camel case (e.g. <tt>TextFileReader</tt>
> and <tt>isLValue</tt>).
> I would really prefer some stylistic difference between variables and
> types/functions. This is mostly a problem (for me) with local variables,
> where having some signifier of the locality helps me in reading it.
Agreed. That's why types start with upper-case while variables start
with lower-case in my proposal.
I chose to start function names with lower-case, but don't feel
strongly about it. If people prefer them to start with upper-case,
fine by me.
> The most common style I have worked with is to use
> under_score_separators for variables. Personally, I would advocate for
> sharing this style with member variables as well, but those aren't as
> important to me when reading code.
I think camelCase works as well as underscore_separated for variable
names, and the former is much more common in the existing code.
That's why I picked it. I could go with underscore_separated were we
starting from scratch.
--
Zhanyong
More information about the cfe-dev
mailing list