[cfe-dev] draft rule for naming types/functions/variables

Chris Lattner clattner at apple.com
Mon Nov 22 23:10:49 PST 2010


On Nov 22, 2010, at 9:40 PM, Chandler Carruth wrote:

> 
> Agreed.  That's why types start with upper-case while variables start
> with lower-case in my proposal.
> 
> This however leaves no distinction between functions and variables. I suppose this isn't a terrible compromise because of the ()s, but I would like it best to have a different style for each.

I don't find this to be a compelling argument.  By that reasoning, all field names should be m_foo and such horrible things.  If a local variable has such a large live range to make it ambiguous or confusing, then something else is already wrong.

To me, the most important thing about having a naming convention is to just make it completely consistent and predictable everywhere instead of people having to remember that one API is isFoo() and another is IsBar().

Don't try to go all hungarian and encode semantics into names through subtle distinctions...

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101122/f571a754/attachment.html>


More information about the cfe-dev mailing list