天天看點

linux windows.h,Windows.h和Windows.h的差別

轉載位址:http://stackoverflow.com/questions/15466613/lowercase-windows-h-and-uppercase-windows-h-difference

google得知:acceptedThere is no difference, and nor could there be as file names on windows (NTFS) are case insensitive.

Actually, according to Filenames are Case Sensitive on NTFS Volumes NTFS has two different modes where one is case sensitive:NTFS supports two slightly different modes of operation that can be selected by the subsystem of the application interacting with NTFS. The first is fully case sensitive and demands that file names supplied by the application match the names stored on disk including case if the file on disk is to be selected. The second mode of operation is case preserving but not case sensitive. This means that applications can select files on the disk even if the supplied name differs in case from the name stored on the disk. Note that both modes preserve the case used to create the files. The difference in behavior noted here applies only when an application needs to locate an existing file. POSIX takes advantage of the full case sensitive mode, while MS-DOS, WOW, and Win32 subsystems use the case insensitive mode.

The file systems on Windows are case insensitve so either one will work when compiling on Windows. However, if you were to compile on Linux using the MinGW cross compiler for example, the case would matter.

The MinGW windows.h header always seems to be lower case.

The Windows.h file provided with Microsoft's tools have used a variety of cases.old VC++ installations (VC++98 and earlier) appear to install WINDOWS.H - all caps

newer VC++ installations and Windows SDKs seem to use Windows.h

some mobile device SDKs (PocketPC or Windows mobile) use windows.h - all lowercase.

Since windows.h will always work on both Windows and a Linux cross compile, I'd use #include  if I ever thought about it. Which I can't recall doing until answering this.

I wouldn't worry about this too much. Even if the capitalized form finds its way onto a Linux MinGW build, an easy (if maybe annoying) fix is to create a Windows.h file that just turns around and includeswindows.h.

簡單來說:

主要是檔案作業系統問題,如果檔案作業系統對大小寫不敏感(eg:Windows),則這兩者無差別。

如果檔案作業系統對大小寫敏感(eg:Linux),則兩者就有差別了。

對Windows系統來說,兩者沒有差別。大寫的Windows.h主要用在SDK程式設計上。

對Linux系統來說,兩者就有差別的。Linux上用小寫的windows.h。

也就是說,在任何情況下,用小寫的windows.h應該都是沒有問題的。

以上純屬個人觀點。