问题
Just curious why the C++ standard library uses all lower case and underscores instead of camelCase
or PascalCase
naming convention.
Personally, I find the latter much easier to deal with when typing out code, but is there some kind of legitimate reason to use the former?
回答1:
Main reason : To keep compatibility with the existing code, since they have done it with C also.
Also have a look at these C++ Coding standards, which presents some generic reasoning regarding the importance of convention.
These links discusses about the naming conventions of C/C++ Standard Library.
- Naming Convention for C API
- C/C++ Library Naming Convention
- C Library Naming Convention
- Why does Java use CamelCase, while C++ doesn't ?
回答2:
Convention. They've done it that way all along, since the C days and before...and didn't see a good reason to break from that convention (not to mention potentially break compatibility with tons of existing code) just to add caps to a bunch of function names.
来源:https://stackoverflow.com/questions/5414511/why-does-the-standard-c-library-use-all-lower-case