Why people don't use uppercase in the name of header files in C++?

我是研究僧i 提交于 2019-12-05 02:33:10

There are systems out there which are case-sensitive (*nix), and there are systems which are traditionally case-insensitive (Windows).

As a result, if you develop on *nix and create two files: baseclass.h and BaseClass.h - your code will compile fine on *nix, but when moving it to Windows, it won't even unpack there properly.

On the other hand, if you develop on Windows and have file BaseClass.h while writing '#include "baseclass.h"' - it will compile on case-insensitive Windows, but will fail to compile on *nix.

To avoid these troubles, there is an unwritten (I think) convention of using all filenames in lowercase - at least it is guaranteed to work the same way everywhere. Kind of the least common denominator approach, which doesn't cause too much inconvenience.

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