我是靠谱客的博主 搞怪草丛,这篇文章主要介绍WIN32和_WIN32的区别,现在分享给大家,希望可以做个参考。

WIN32 is a name that you could use and even define in your own code and so might clash with Microsoft's usage. _WIN32 is a name that is reserved for the implementor (tn this case MS) because it begins with an underscore and an uppercase letter - you are not allowed to define reserved names in your own code, so there can be no clash.

  • WIN32 is defined by the SDK or the build environment, so it does not use the implementation reserved namespace
  • _WIN32 is defined by the compiler so it uses the underscore to place it in the implementation-reserved namespace

You'll find a similar set of dual defines with nearly identical names and similar uses such as _UNICODE/UNICODE, _DEBUG/DEBUG, or maybe _DLL/DLL (I think that only the UNICODE ones get much of any use in their different versions). Though sometimes in these cases (like _UNICODE), instead of the underscore version being defined by the compiler, they are used to control what the CRT headers do:

  • _UNICODE tells the CRT headers that CRT names which can be either Unicode or ANSI (such as _tcslen() should map to the wide character variant (wcslen())
  • UNICODE does something similar for the SDK (maps Win32 APIs to their "W" variants)

参见:http://stackoverflow.com/questions/662084/whats-the-difference-between-the-win32-and-win32-defines-in-c

最后

以上就是搞怪草丛最近收集整理的关于WIN32和_WIN32的区别的全部内容,更多相关WIN32和_WIN32内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(62)

评论列表共有 0 条评论

立即
投稿
返回
顶部