Thiago Farina
2010-Dec-04 04:03 UTC
[LLVMdev] [cfe-dev] draft rule for naming types/functions/variables
On Mon, Nov 29, 2010 at 5:02 AM, Anton Korobeynikov <anton at korobeynikov.info> wrote:>> I enjoyed the new coding style in recent patches. Camel case makes it easy >> to pick a descriptive name. Starting functions and variables with lower >> cases reduces chances to conflict with a type name. > Honestly speaking, I don't. Especially in the cases when varname is > made from an > acronym. E.g. MachineInstr *MI looks much better than MachineInstr *mi, etc. >Hum? I don't think MI is better. I haven't see this style until clang/llvm. Many others open source projects just uses the normal lower case variable, which is MUCH better IMO. For me is confusing to have a variable starting with captial letter, because it's hard to differentiate it from class names.
Chris Lattner
2010-Dec-04 07:14 UTC
[LLVMdev] [cfe-dev] draft rule for naming types/functions/variables
On Dec 3, 2010, at 8:03 PM, Thiago Farina wrote:> On Mon, Nov 29, 2010 at 5:02 AM, Anton Korobeynikov > <anton at korobeynikov.info> wrote: >>> I enjoyed the new coding style in recent patches. Camel case makes it easy >>> to pick a descriptive name. Starting functions and variables with lower >>> cases reduces chances to conflict with a type name. >> Honestly speaking, I don't. Especially in the cases when varname is >> made from an >> acronym. E.g. MachineInstr *MI looks much better than MachineInstr *mi, etc. >> > > Hum? I don't think MI is better. I haven't see this style until > clang/llvm. Many others open source projects just uses the normal > lower case variable, which is MUCH better IMO. > > For me is confusing to have a variable starting with captial letter, > because it's hard to differentiate it from class names.Thiago, The coding standards (which have been finalized and comitted) don't dictate names for local variables. -Chris
Thiago Farina
2010-Dec-05 00:25 UTC
[LLVMdev] [cfe-dev] draft rule for naming types/functions/variables
On Sat, Dec 4, 2010 at 5:14 AM, Chris Lattner <clattner at apple.com> wrote:> Thiago, > > The coding standards (which have been finalized and comitted) don't dictate names for local variables. >Do you like the fact that local variables start with capital letter? Following the same convention used to name classes? It's a very strange adoption. I like the way that classes are named using CamelCase (MyClass, for example) and the instance of MyClass is my_class. That avoids many confusions in my brain. This convention used here: MyClass* MC = new MyClass, is an obstacle for external contributors used to work with C for example, where almost everything (and every project) uses the unix_hacker style.
Maybe Matching Threads
- [LLVMdev] [cfe-dev] draft rule for naming types/functions/variables
- [LLVMdev] [cfe-dev] draft rule for naming types/functions/variables
- [LLVMdev] [cfe-dev] draft rule for naming types/functions/variables
- Having trouble extending a class from a Rails plugin
- Forking a process in Rails is messing up mongrel