I’m a fairly rookie C++ programmer, but in my limited experience with the language, most standard C++ style guidelines (e.g. Google C++ Style Guidelines) go against what is implemented in the stl and boost libraries.
For example, class names in the C++ standard library and Boost are always lower case, with underscores separating words (e.g. std::vector, boost::unordered_map, std::map::const_iterator), whereas most style guides I’ve seen for C++ tend towards a CamelCase style (e.g. TcpConnection or Int32).
The same applies to methods too. The standard library and Boost use the same style for methods and functions as they do for classes (e.g. std::map<>::get_equal("foo")), whereas most style guides advocate pascalCase or CamelCase.
If we contrast this with a language like Ruby, where most users will adhere to the conventions used in the core libraries, it seems odd that there’d be such a difference between the standard C++ libraries and everyone else’s code.
Does anyone know why this is?
EDIT: Just to clarify, I’m talking simply about the superficial textual style (casing, use of underscores, etc) rather than actual implementation style.
underscores and lowercase was the style perferred by Bjarne Stroustrup in “The C++ Programming Language”. If I recall correctly he had made a statement along the lines that underscores in names were to be preferred because it was more readable to an international community where english is not the primary language. I have no idea if his opinion is true or not, but I’m guessing that’s the origin.
Here’s a link to his FAQ where he discusses this very topic:
http://www.stroustrup.com/bs_faq2.html#Hungarian
Snippet explaining what you were interested in in particular: