[LLVMdev] RFC: variable names

Gregory Junker gjunker at dayark.com
Mon Oct 13 16:17:46 PDT 2014


On 10/13/2014 3:04 PM, Nick Kledzik wrote:

> 3. Allows name re-use. Since types and variables are both nouns, using
> different capitalization allows you to use the same simple name for
> types and variables, for instance:

class Foo
{
     int mBar;

public:
     void bar(int aBar) {
         mBar = aBar;
     }

     void foo(int aFoo) {
         // compiler complains -- is this *really* the end of the world?
         // Just pick another name...
         int bar = aFoo;
     }
};

"mName" is perfectly unambiguous, "aName" for arg names allows use of 
essentially the same name in methods without being obnoxious, and none 
of it involves underscores (which sets my teeth on edge, speaking 
personally).

Greg



More information about the llvm-dev mailing list