I was wondering why people don't use uppercase in name of header files. I see many header files with name only in lowercase. But I thought it would be more easy to read if they write them with uppercase, say "BaseClass.h", "SubClass.h", instead of "baseclass.h", "subclass.h". Why is that? Or it's just that the header files I've seen are named only in lowercase?
-
2I've seen both. Either will work. It's a matter of preference. I prefer lowercase for all file names in general including headers because I can avoid using shift when typing their name. – eerorika May 28 '15 at 10:15
-
refre this https://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=382 – ANjaNA May 28 '15 at 10:16
-
3"Or it's just that the header files I've seen are named only in lowercase?" - yes. – Mike Seymour May 28 '15 at 10:29
-
Thanks for your help guys – zj_yyzr May 28 '15 at 10:34
-
My guess is that once you have the library includes there
etc people just continue that format for their own headers. (I don't.) – Ant May 28 '15 at 12:29
1 Answers
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.

- 1,557
- 14
- 15
-
4Avoiding these troubles though gives you others. E.g. `qxsdvalidatinginstancereader.cpp` source file in Qt — do you easily read what it's about? – Ruslan Jan 12 '18 at 11:32
-
7@Ruslan: validating_instance_reader.cpp would be as-readable-as-anything-else - and lower-case too. In other words - if some people don't want to use underscores - I don't see it as a problem of the lower-case... – No-Bugs Hare Jan 13 '18 at 07:20
-
-