Why does the standard C++ library use all lower case?

时间秒杀一切 提交于 2019-12-04 15:25:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!