Windows.h和Windows.h的区别


转载地址:http://stackoverflow.com/questions/15466613/lowercase-windows-h-and-uppercase-windows-h-difference

google得知:

accepted

There 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 <windows.h> 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应该都是没有问题的。


以上纯属个人观点。

你可能感兴趣的:(Difference,windows.h,windows.h)