C++: UpperCamelCase or lowerCamelCase?

Started by
31 comments, last by Alpha_ProgDes 16 years, 10 months ago
Which do you prefer for method names? I'm getting ready to start writing a bunch of new code, and I can't decide which to use! So, I'm looking for a compelling reason to use one or the other. :) Thanks!
Advertisement
I personally prefer upper camel case, but I don't really mind that much either way.

I'm usually fine with most standard naming conversions, with the possible exception of the one where classes are named in upper camel case with a leading C, such as CSomeClass. That C makes it extremely hard for me to parse the class name at a glance; if you want to use prefixes I prefer separating them out with an underscore like C_SomeClass instead.
I use lol_underscores_lol case. But UpperCamelCase is next in terms of preference. I wouldn't wart it up, though. But class names are formal names, no? In English, this means Capitalization.
I always follow the conventions of the standard library of which ever language I'm working in, leads to more consistent feeling code that way.

In C++ that means I use underscores but out of those two choices I prefer UpperCamelCase.
I very much prefer UpperCamelCase for typenames, and lowerCamelCase for instances and method names.
I like all_lower_with_underscores too, it's much easier to read.

As for UpperCamelCase vs. lowerCamelcase, I use both. At work we use UpperCamelCase for classes, structs, functions, and member variables (after the initial m_ and optional p (for pointers)).
lowerCamelCase is only used for auto variables.

It's a stupid system, but it's better than it was (same plus more warts).
UpperCamelCase for methods and typenames, lowerCamelCase for private member variables and local variables.
Worry about something important.
What I use:

template < typename BaseClass >class some_basic_type{  void foo( BaseClass variable )  {    m_variable = variable;  }private:  BaseClass m_variable;};typedef some_basic_type<int> IntType;class ConcreteType{  void foo_bar( );} 


Concrete types use camel case. Templated types use the STL style, since they get typedefed into CC.

This makes for conventient distinction, and makes use of template parameters look natural in the code.
I am currently do it the ruby way (ClassName, method_name, variable_name)... I previously used .NET naming conventions.

This topic is closed to new replies.

Advertisement